* daml script-test choose free port
* Remove exclusive tag on script-test
The test was marked exclusive because it required access to port 6865.
However, the test-runner now automatically chooses a free port at
runtime.
Co-authored-by: Andreas Herrmann <andreash87@gmx.ch>
* Start on daml test-scripts
* Run all `Script a` as test cases
* LedgerClient: Expose PackageManagementClient
To enable DAR uploads
* Upload the DAR to the ledger
* Start sandbox if no ledger specified
* Format daml test-script
* Fix deprecation warning on ActorMaterializer
* Add test-case //daml-script/tests:test_daml_script_test_runner
* Add daml test-script command
CHANGELOG_BEGIN
- [DAML Script - Experimental] Allow running DAML scripts as test-cases.
Executing ``daml test-script --dar mydar.dar`` will execute all
definitions matching the type ``Script a`` as test-cases.
See `#3687 <https://github.com/digital-asset/daml/issues/3687>`__.
CHANGELOG_END
* daml-test-script enable logging
* Remove outdated TODO comment
* daml script-test More elaborate test-caseo
Compare to expected output and add failing test-case
* daml test-script Don't abort on test-failure
Before the test runner would abort on the first failed test-case. This
occasionally introduce additional test-failures if the sandbox was
torn down half-way through execution.
* ./fmt.sh
Co-authored-by: Andreas Herrmann <andreash87@gmx.ch>
This commit aims at mitigating two issues we have noticed with the
0.13.41 release:
1. The initial cron run for that release got interrupted at the 50
minutes mark, which happened to be right in the middle of the s3 upload.
This means it had already changed the versions.json file, but had not
finished updating the actual html files. Right now, the docs.daml.com
website shows version 0.13.41 in the drop-down, but actually displays
the content for 0.13.40. Additionally, trying to explicitly visit the
website for 0.13.41 (https://docs.daml.com/0.13.41) yields a 404. Note
that this also means the cron job did not reach the "tell HubSpot"
point, so 0.13.41 did not get announced.
2. As the script also did not reach the "clear cache" step, subsequent
runs have been rebuilding the documentation for no reason as the
sequence of steps was: check versions.json through HTTP, get cached one,
see it's not up-to-date, build docs, check versions.json through s3 API,
bypassing the cache, see it's up-to-date, stop.
To address those issues, this PR changes the cron to:
1. Increase the timeout to 2h instead of 50 minutes.
2. Always check the versions.json file through s3, rather than go
through the HTTP cache first.
These are not complete solutions but I'm not sure how to do better given
that s3 does not have atomic operations.
As mentioned in the inline comment, this matches the behavior on the
Scala side and given that most people configure their editors to
always add trailing newlines, this is quite convenient (especially
given that the error message is horrible if you do include the
newline).
* Change variant json encoding,
adding integration test
* Add DamlLfTypeLookup dependencies
* Add MetadataReader
* Add test WIP
* Add serialize test cases
* Add serialize test cases, WIP
* Test for variant encoding decoding
* Solving merge conflicts
* Updating roundtrip test
* Minor cleanup
* Addressing code review comments
Add JsonVariant custom matcher
* Update specification
* Update link
* Add test case, WIP
* Add proper template key resolution
* Got rid of choice record ID resolution, resolving choice type and key type
* Fixing logging
* Add Contract Key decoding tests
* cleanup
* cleanup
* Update JSON variant encoding tests
* Add more contract key JSON decoding tests
* Fix variant JSON encoding
* Change value predicate to support new variant encoding
* Change value predicate to support new variant encoding
* Add lookup by contract key test case
where contract key contains variant and record
Add `requiredResource` to bazel utils
CHANGELOG_BEGIN
- [JSON API - Experimental] Change variant JSON encoding. The new format is ``{ tag: data-constructor, value: argument }``.
For example, if we have: ``data Foo = Bar Int | Baz``, these are all valid JSON encodings for values of type Foo:
- ``{"tag": "Bar", "value": 42}``
- ``{"tag": "Baz", "value": {}}``
See #3622
- [JSON API - Experimental] Fix ``/contracts/lookup` find by contract key.
- [JSON API - Experimental] Fix ``/command/exercise`` to support any LF type as a choice argument.
See #3390
CHANGELOG_END
* minor cleanup
* Fix copy/paste
* Renaming
* Got rid of DAML LF identifier resolution
resolving DAML LF Type based on command type
* Address code review comments, thanks @S11001001
* Address code review comments, thanks @S11001001
Do not include any error handling here; this partial function should
only match the successful case, JsonVariant.
* Address code review comments, thanks @S11001001
comment
* Address code review comments, thanks @S11001001
using `JsonVariant` for variant encoding/decoding
* Address code review comments, thanks @S11001001
replace `find` and `map` chain with collectFirst
* Update docs/source/json-api/lf-value-specification.rst
Co-Authored-By: Stephen Compall <stephen.compall@daml.com>
Co-authored-by: Stephen Compall <scompall@nocandysw.com>
* sandbox: Create a monadic `ResourceOwner` to manage resources.
* sandbox: Rewrite `ResourceOwner` to be async.
* sandbox: Make sure failed resources are closed immediately.
* sandbox: Better naming in `Open`.
* sandbox: Rename `Open` to `Resource`, and open/close to acquire/release.
* sandbox: Convert `() => AutoCloseable` into `ResourceOwner`.
* sandbox: Refactor the LedgerApiServer in terms of resources.
* sandbox: Explicitly convert `() => AutoCloseable` to `ResourceOwner`.
Explicit > Implicit, right?
* sandbox: Create helpers for converting things to ResourceOwners.
Because I tried to start using them and there was so much code being
written at once.
* sandbox: Simplify construction of JdbcLedgerDao.
* sandbox: Releasing resources should be idempotent.
In that we should only do it once.
* sandbox: Fix the ResetService by closing the API services _first_.
They need to be shut down before the gRPC server.
* sandbox: Don't try and shut down PostgreSQL twice in tests.
* sandbox: Actually run the assertions in ResourceOwnerSpec.
Facepalm.
* sandbox: Test `Resource.sequence` more rigorously.
* sandbox: Move the helpers around `Resource` into `Resource.apply`.
* sandbox: Convert LedgerApiServer resource owners to classes.
* sandbox: Make `ResourceOwner` a monad too, delegating to `Resource`.
* sandbox: Turn `LedgerApiServer` into a ResourceOwner.
* sandbox: Simplify the public signature of `Resource.apply`.
* sandbox: Use ResourceOwners to simplify DB resource management.
This is one hell of a change. Sorry.
* sandbox: Try not to nest `Await.result` calls.
Causes issues when running in a `DirectExecutionContext`.
* sandbox: Turn index subscriptions into resources.
* sandbox: Fix warnings in RecoveringIndexerSpec.
* sandbox: Always release before recovering the indexer.
* sandbox: Add `flatten` and `transformWith` to `Resource`.
* sandbox: If releasing twice in parallel, the second should wait.
* sandbox: If the indexer recovers, clean up the old subscription.
* sandbox: Convert StandaloneIndexerServer into a resource owner.
* sandbox: Convert StandaloneApiServer into a resource owner.
* reference-v2: Rewrite ReferenceServer in terms of resources.
CHANGELOG_BEGIN
- [Reference v2] On an exception, shut down everything and crash.
Previously, the server would stay in a half-running state.
CHANGELOG_END
* sandbox: Rewrite SandboxServer in terms of resources.
* sandbox: Write the port file in a Future.
* sandbox: JdbcIndexer no longer needs to manage the actorSystem.
* sandbox: Shut down the LedgerApiServer when closing the Sandbox.
* sandbox: Rename `Resource.pure` to `Resource.successful`.
* sandbox: Rename `Resource.sequence_` to `sequenceIgnoringValues`.
* sandbox: Delete `CloseableResource`.
It's only used in once place. Just inline it.
* sandbox: `LedgerDao` no longer needs to be closeable.
* sandbox: Delete implicit materializers where they're not used.
* http-json: Wait for the Sandbox to start in tests.
* sandbox: Convert `scheduleHeartbeats` into a ResourceOwner.
* reference-v2: Explain why we steal ownership of the actor system.
* sandbox: Document why we only release resources once.
* sandbox: Add clues to ResourceOwnerSpec.
* http-json: Fix HttpServiceTestFixture to pass auth service through.
* codegen-sample-app: In ScalaCodeGenIT, wait for the server to start.
* runtime-filtering-only-style enum for ValueAddend
- the alternative is a coproduct of singleton types, which would be more
like the other ValueAddend combinators, but done differently here as
an experiment
* test an enum case for lf-value-json
* Moves CommandCompletionIT to Ledger API Test Tool
Closes#2841
Also refactors test observers into a single API and unifies the existing implementations of the DirectExecutionContext
* Allow explicit offsets to get checkpoints
* Raise checkpoint test timeout
* Consolidate checkpoint tests in a single test case
* Fix compilation issues
* Exclude command submission/completion tests for rev-v2
* Drop test not relevant for Ledger API implementations
* Fix compilation errors
Closes#2842Closes#2843
The separation between high-level and low-level is not particularly meaningful, as the low-level variant issues commands with a component used by the high-level variant.
The separation aims at performing integration tests at two different levels but this can be addressed by a single suite of integration tests and relying on unit testing for individual components.
The first two tests:
- 'having many transactions all of them has a unique event id' reads transactions from an empty ledger and doesn't really test anything, so this has been dropped because the uniqueness of event identifiers is already more than covered by many tests in the 'TransactionService' suite.
- 'handle bad Decimals correctly' ensures the ledger api rejects unrepresentable decimals and it have been re-implemented as 'Reject unrepresentable numeric values' in the 'CommandService' suite.
The other tests are about command-and-exercise:
- 'process valid commands with workflow ids successfully' -> 'Implement create-and-exercise correctly'
- 'fail for invalid create arguments' -> 'Fail create-and-exercise on bad create arguments'
- 'fail for invalid choice arguments' -> 'Fail create-and-exercise on bad choice arguments'
- 'fail for an invalid choice' -> 'Fail create-and-exercise on invalid choice'
* Upgrade to Akka 2.6.1, akka-http 10.1.11 and Scala 2.12.10
Akka 2.6.1 Upgrade Changes
- Materializer in place of ActorMaterializer
- Source.future instead of Source.fromFuture
- The Scheduler.schedule method has been deprecated in favor of selecting scheduleWithFixedDelay or scheduleAtFixedRate
- onDownstreamFinish(cause: Throwable)
- ActorAttributes.supervisionStrategy(...) in place of ActorMaterializerSettings.withSupervisionStrategy
See https://doc.akka.io/docs/akka/current/project/migration-guide-2.5.x-2.6.x.html
* Akka 2.6.1 Upgrade Changes
- onDownstreamFinish(cause: Throwable)
See https://doc.akka.io/docs/akka/current/project/migration-guide-2.5.x-2.6.x.html
* code review: remove unnecessary supervision strategy
* sandbox: Fix warnings in RecoveringIndexerSpec.
* sandbox: Test RecoveringIndexer logs, and stop dumping them to STDERR.
Printing logs during test execution is really annoying. This stubs the
logger factory with a TestNamedLoggerFactory which captures them in a
list instead, for testing purposes.
* sandbox: Remove unnecessary comments from {,Simple}NamedLoggerFactory.
* ledger-api-common: Remove unused parts of the NamedLoggerFactory.
* drop Nones from records when JSON-encoding
* elide some needless conversions in ApiCodecCompressed
* record with visible Inj
- seems to be running up against scala/scala#5075
* use new 3rdparty lib reference
* construct record types field-by-field
- works around scala/scala#5075
* switch to record style for records' Inj
- suggested by @leo-da
* include some samples to experiment with record
* record parsing
* RecordVa doesn't benefit from kind-projector
* scalafmt
* make RecordVa details private; only intended API is public
* Arbitrary and Shrink record support
* rename RecordVa#Inj to HRec, to accommodate variants in same cons structure
* use record testing in lf-value-json
* add complex record type
* add complex record value and test it
* more documentation for RecordVa
* Table-ify prior record tests
* start adding variant support
* scalacheck support for variants
* more scalacheck support for variants
* variant examples
* example of using align for records
* test variant roundtrip
* test variant in record
* add sample tests for the JSON format of records and variants
* rename record-specific functions in RecordVa
* rename RecordVa to RecVarSpec
Using the default configuration as a base for this test meant binding on 6865 instead of using dynamic port binding, which could cause flaky errors if some other test is occupying the port
I managed to break our Windows CI twice already due to this so while
it makes me sad, I think hardcoding those files is the more sensible
option for now.
I’ve seen a bunch of builds on MacOS that seemed to hang forever
somewhere during loading the target (during the step where ghci is
loading modules so after Bazel). I don’t quite know what is going on
there but it seems to correlate with the change in
https://github.com/digital-asset/daml/pull/3829 that further extended
the repl target. Given that the GHCi step takes several minutes by
now, even if it is successful, I think it makes sense to limit this to
damlc given that we very rarely have issues that would result in damlc
loading but the repl target not loading (and very few people use the
latter anyway).
* re-add cleanup for /tmp to remove 700ish mb of unneeded temp files made by the sdk installer
* Set WORKDIR to daml user home dir so that sdk tools can create files
* add daml sdk config defaults for auto-install and update-check sdk install RUN command
* add --no-cache to apk add to reduce size a little
* add line return to end of daml-config.yaml
* Update ledger-api-test-tool readme instructions for daml docs
* remove STDERR / STDOUT pipe to file examples
* address review feedback
* Add commentary on tests which can be excluded for an --all-tests run because of clock, stress or mutation issues
* Move Any wrappers and Archive to stable packages
There are no actual API or functionality changes in this PR but the
logic for locating the stable packages has slightly changed since the
Any wrappers package only makes sense for LF 1.7. To address this, we
simply filter out stable packages for newer LF versions since it
doesn’t make sense to depend on those anyway.
CHANGELOG_BEGIN
- [DAML Compiler] Move ``Archive`` type to a separate DALF.
CHANGELOG_END
* More comments
* Fix java codegen tests
* fix more tests
* Force cache reset on Windows
* Revert "Force cache reset on Windows"
This reverts commit 9f2b7d70b2.
CHANGELOG_BEGIN
- [DAML Ledger Integration Kit] Move to asyncronous package management service (#3806)
- [DAML Ledger Integration Kit] Fix indexer crash on duplicate submission. See #3847
- [DAML Ledger Integration Kit] Standardize and cleanup metric names to use underscores that are compatible with Prometheus
- [DAML Ledger Integration Kit] Add FailingCommandsIT and CommandSubmissionCompletion to Ledger test tool suite. Some of the tests previously part of the CommandService Ledger API Test Tool suite have been moved to a new home in CommandSubmissionCompletion to reflect the fact that those use the submission/completion workflow instead of leveraging the submit-and-wait alternatives.
CHANGELOG_END
Signed-off-by: Brian Healey <brian.healey@digitalasset.com>
* Fix roundCommercial
fixes#3884
Previously, we relieid on being able to convert to an Int, which
doesn’t work since there are Numeric values that cannot be represented
as an Int. Now, we avoid any conversions to Int which fixes this
issue.
We probably just want to have a primitive for this at some point but
given that this will only be available in newer LF versions, I think
it’s worth working around this for now.
* Move tests to a separate file to exclude LF 1.6
* Update compiler/damlc/daml-stdlib-src/DA/Internal/Prelude.daml
Co-Authored-By: Remy <remy.haemmerle@daml.com>
* Apply suggestions from code review
Co-Authored-By: Remy <remy.haemmerle@daml.com>
* Update comments
* Update compiler/damlc/daml-stdlib-src/DA/Internal/Prelude.daml
Co-Authored-By: Remy <remy.haemmerle@daml.com>
This test suite was introduced in #3870 and seems to be extremely
flaky both locally (I get about 16/20 failures) and on CI.
The error is
- should return completions of commands that are submitted after subscription *** FAILED *** (4 seconds, 945 milliseconds)
Set() did not contain all elements of List("5104", "5100", "5105", "5109", "5103", "5106", "5107", "5102", "5108", "5101") (CommandClientIT.scala:330)
After bumping the timeout, I don’t get any failures locally.
Happy to choose another timeout, I have no clue what a sensible value
is here.
* Port FailingCommandsIT to the Ledger API Test Tool
Closes#2850
The FailingCommandsIT suite contains tests for mismatching ledger
identifier (which is already abundantly covered by the Ledger API Test
Tool) and for bad labels in contract creation, both via submit and
submitAndWait.
Some of the tests previously part of the CommandService Ledger API Test
Tool suite have been moved to a new home in CommandSubmissionCompletion
to reflect the fact that those use the submission/completion workflow
instead of leveraging the submit-and-wait alternatives.
There are also suites that for some reason cover subsequent invocations
of the same services but I'm not sure of the meaning of those and I
would drop them, unless we have a good explanation for those.
* Optimize imports
* Move stable types from DA.Internal.Template to a separate module
This is in preparation for splitting them into a separate LF package
with a stable package id.
* Fix visualization
* Fix data dependencies
* Fixing a rare test failure,
two independent scalacheck Gens generate duplicate TemplateIds. Duplicate
in this context means having the same moduleName and entityName.
```
- TemplateIdMap.unique should not contain dups *** FAILED *** (102 milliseconds)
TestFailedException was thrown during property evaluation.
Message: None was not equal to Some(TemplateId(zy,n,s))
Location: (PackageServiceTest.scala:81)
Occurred when passed generated values (
arg0 = List(TemplateId(zy,n,s)),
arg1 = List(TemplateId(lj,n,s), TemplateId(g,n,s))
)
```
* Addressing code review comments, thanks @S11001001
* Addressing code review comments, thanks @SamirTalwar
* Minor cleanup