Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add golden test for example Daml ledger export #9732

Merged
merged 10 commits into from
May 19, 2021
Merged

Add golden test for example Daml ledger export #9732

merged 10 commits into from
May 19, 2021

Conversation

aherrmann-da
Copy link
Contributor

Addresses part of #9446 (comment)

  • Adds an example Daml ledger export to the docs tree to be used as an example in the Daml ledger export documentation.
    Incorporating it in the actual documentation is left for a follow-up PR.
  • Adds a Bazel build target to generate a Daml ledger export using client_server_build.
  • Adds a golden test that compares the example export in the docs to the one generated by the build target.
  • Some minor changes in support of the above:
    • Expose an overload of the Daml script runner's main function that takes a config object
    • Extend client_server_build to support multiple output files.
    • Extend sh_inline_test to support toolchains for make variable substitution.

Pull Request Checklist

  • Read and understand the contribution guidelines
  • Include appropriate tests
  • Set a descriptive title and thorough description
  • Add a reference to the issue this PR will solve, if appropriate
  • Include changelog additions in one or more commit message bodies between the CHANGELOG_BEGIN and CHANGELOG_END tags
  • Normal production system change, include purpose of change in description

NOTE: CI is not automatically run on non-members pull-requests for security
reasons. The reviewer will have to comment with /AzurePipelines run to
trigger the build.

aherrmann added 7 commits May 18, 2021 18:26
Let the user define a list of output files on client_server_build.

changelog_begin
changelog_end
changelog_begin
changelog_end
changelog_begin
changelog_end
Support toolchain arguments to sh_inline_test. Usefuly for make variable
expansion, e.g. for the POSIX toolchain.
@@ -29,108 +29,109 @@ import com.daml.auth.TokenHolder
object RunnerMain {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is best reviewed ignoring white-space changes.

Copy link
Contributor

@cocreature cocreature left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thank you!

script-options: [--input-file, args.json]
parties: [Bank,Alice,Bob]
dependencies: [daml-stdlib, daml-prim, daml-script]
data-dependencies: [EXPORT_OUT/deps/daml-stdlib-0.0.0-68a8ef91f10c283e1a5fc914bbf0addd41a089ad3625641966df2415e6010e2e.dalf,EXPORT_OUT/deps/script-test-0.0.1-87967f7d2b53db9652bd343a24db7cbe371c4b105005d57eed853bd309bac477.dalf,EXPORT_OUT/deps/c1f1f00558799eec139fb4f4c76f95fb52fa1837a5dd29600baa1c8ed1bdccfd.dalf,EXPORT_OUT/deps/733e38d36a2759688a4b2c4cec69d48e7b55ecc8dedc8067b815926c917a182a.dalf,EXPORT_OUT/deps/bfcd37bd6b84768e86e432f5f6c33e25d9e7724a9d42e33875ff74f6348e733f.dalf,EXPORT_OUT/deps/518032f41fd0175461b35ae0c9691e08b4aea55e62915f8360af2cc7a1f2ba6c.dalf,EXPORT_OUT/deps/cc348d369011362a5190fe96dd1f0dfbc697fdfd10e382b9e9666f0da05961b7.dalf,EXPORT_OUT/deps/6839a6d3d430c569b2425e9391717b44ca324b88ba621d597778811b2d05031d.dalf,EXPORT_OUT/deps/99a2705ed38c1c26cbb8fe7acf36bbf626668e167a33335de932599219e0a235.dalf,EXPORT_OUT/deps/76bf0fd12bd945762a01f8fc5bbcdfa4d0ff20f8762af490f8f41d6237c6524f.dalf,EXPORT_OUT/deps/e22bce619ae24ca3b8e6519281cb5a33b64b3190cc763248b4c3f9ad5087a92c.dalf,EXPORT_OUT/deps/d58cf9939847921b2aab78eaa7b427dc4c649d25e6bee3c749ace4c3f52f5c97.dalf,EXPORT_OUT/deps/6c2c0667393c5f92f1885163068cd31800d2264eb088eb6fc740e11241b2bf06.dalf,EXPORT_OUT/deps/d14e08374fc7197d6a0de468c968ae8ba3aadbf9315476fd39071831f5923662.dalf,EXPORT_OUT/deps/057eed1fd48c238491b8ea06b9b5bf85a5d4c9275dd3f6183e0e6b01730cc2ba.dalf,EXPORT_OUT/deps/e491352788e56ca4603acc411ffe1a49fefd76ed8b163af86cf5ee5f4c38645b.dalf,EXPORT_OUT/deps/daml-prim-0.0.0-b76d13799ea5488f281440b63072ad3e3d48d72936144e7d19209c9cf115aa9d.dalf,EXPORT_OUT/deps/40f452260bef3f29dede136108fc08a88d5a5250310281067087da6f0baddff7.dalf,EXPORT_OUT/deps/daml-stdlib-DA-Set-Types-1.0.0-97b883cd8a2b7f49f90d5d39c981cf6e110cf1f1c64427a28a6d58ec88c43657.dalf,EXPORT_OUT/deps/daml-script-0.0.0-024f7a831e04595b36c668121dce9209d63e5a6a46f01a4533fca5e4c521e7e4.dalf,EXPORT_OUT/deps/8a7806365bbd98d88b4c13832ebfa305f6abaeaf32cfa2b7dd25c4fa489b79fb.dalf]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe worth changing our generated code to split this over multiple lines. this is getting out of hand

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. I'll address it in a separate PR as it seems out of scope for this one.

Copy link
Contributor

@stefanobaghino-da stefanobaghino-da left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a couple of notes.

Comment on lines +155 to +157
# Compare the generated Daml ledger export to the example export used in the
# documentation. This functions as both a golden test on ledger exports and to
# make sure that the documentation stays up-to-date.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. 😃

Comment on lines +1 to +2
-- Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
-- SPDX-License-Identifier: Apache-2.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file the golden master? Does the comparison somehow skip comments? Should we add this file to the license checking exclusion list?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Answering my own question: yes, the comparison skips comments. To make sure we don't change the golden master every year, it would probably make sense to remove the license header.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we update the headers in all our docs every year so including the golden master in that seems probably more consistent 🤷

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No strong opinion on my side. I'm happy to keep it this way for consistency.

Comment on lines +165 to +166
# Normalize the expected file by removing the copyright header and any documentation import markers.
# Normalize the actual output by adding a newline to the last line if missing.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these comments go on top of the test rule? Spotting comments on inlined scripts can be tricky. Duplicating the comment is probably fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point. I've expanded the top comment and kept the comment in the inline code.

aherrmann added 2 commits May 19, 2021 13:30
The JSON formatting of the args file uses Windows line endings on
Windows. Therefore, the args.json output technically differs from the
expected output. We're happy to ignore the difference in CRLF here.
@mergify mergify bot merged commit 10177d2 into main May 19, 2021
@mergify mergify bot deleted the example-export branch May 19, 2021 12:02
@aherrmann-da aherrmann-da mentioned this pull request May 20, 2021
6 tasks
azure-pipelines bot pushed a commit that referenced this pull request May 26, 2021
This PR has been created by a script, which is not very smart
and does not have all the context. Please do double-check that
the version prefix is correct before merging.

@aherrmann-da is in charge of this release.

Commit log:
```
2710fad Normalize rollback nodes when a transaction is constructed (#9712)
646c956 new windows signing (#9786)
cae4292 Upgrade rules-nodes to version 3.5.0 (#9635)
a336363 ghc-lib: update (#9742)
8ef9361 Scenario: Test ArithemticError (#9757)
ad529e9 http-json-perf: querying larger ACSes with different data patterns (#9530)
0b24655 Fix archive calls in ExceptionsIT (#9787)
abb7142 Update LF spec for exceptions. (#9784)
d208979 Make succ/pred throw an ArithmeticError on overflow. (#9783)
cd2ed07 Rename ContractError to PreconditionFailed (#9782)
1b428be Add ledger API test tool tests for rollback projections (#9778)
fb6f72c debug signtool on main (#9780)
459de1c update NOTICES file (#9781)
61293c3 maybe fix azuresigntool invocation (#9779)
66b8f19 DPP-406 split append only migration (#9777)
45bca6e test_windows_signing: install for u (#9776)
ed36caa Make use of nameOf for naming telemetry traces in participant-integration-api (#9762)
6f20d78 Makes sandbox-classic compression configurable (#9770)
b8afa02 test_windows_signing: add quotes (#9773)
4af6608 fix signing machine (#9772)
5717356 fix test_windows_signing job name (#9771)
5855a99 LF: Drop CONTRACT_ERROR (#9754)
f5c5b63 prepare for EV Windows signing (#9758)
88c83ec Mark //daml-assistant/daml-helper:test-deployment as flaky (#9769)
fa0815b Example export (#9756)
3b33397 update NOTICES file (#9767)
4f97a4d Avoid test log collisions across platforms (#9763)
6f631da Use munit for diffs in ledger-api-test-tool (#9765)
92568eb Make hikari connection pool timeout configurable (#9750)
38cb8b4 Fix flaky CMConcurrentSetConflicting conformance test (#9766)
d2bce16 DPP-335 Implement data migration for the append-only schema (#9481)
765d7e3 Throw ContractError in template precondition field (#9760)
f5a03b3 Stop leaking Sdk installations from assistant integration tests (#9751)
a277560 LF: change format of ArithmeticError message (#9761)
90180eb Make sure we don’t start leaking directories in compat tests (#9759)
beb2d13 Add cli option & system property to enable json only logging for http json service (#9725)
3827f82 Fix consumedBy in rollback nodes for scenario service (#9746)
2ba5ca7 Make DA.Assert throw AssertionFailed instead of GeneralError (#9747)
b9c36c9 Disable per commit windows compat tests (#9755)
b1ca310 ledger: Damlification of Scala files (#9667)
40cf26f Log improvements for parallel indexer (#9752)
3bf6531 ledger-service, navigator: Damlification of Scala files (#9669)
f947c02 Extend ConfigManagementServiceIT with tests on generation checking (#9753)
f5c84a2 Daml-LF: Damlification of Scala/Haskell files (#9666)
0d931b2 Speedy: implement Arithmetic builtin exceptions (#9653)
5f954da Fix flakiness in hot reload tests (#9748)
40b2381 Compiler: clean convertion builtin name (#9724)
7b1a776 Dpp 384 todo cleanup postgres storage backend (#9727)
2e9bb21 Engine: clean conversion builtin names (#9726)
8efdde6 FutureResourceOwner --> ResourceOwner.forTry (#9720)
1794a6f Refactor GenerateStablePackages (#9744)
14cfe99 update compat versions for 1.14.0-snapshot.20210518.6953.0.a6c7b86a (#9741)
83d60f0 more frequent Windows cache cleanup (#9743)
10177d2 Add golden test for example Daml ledger export (#9732)
bb5dd4c Fix locking of envScenarioContexts (#9736)
fcbba1c LF: rename convertion builtins to be more obvious (#9716)
b55613b Parallelize the data-dependencies test. (#9733)
3209188 Add a ledger model page for exceptions. (#9396)
6245e34 Drop damlc integration test todo (#9735)
ae523c7 `ledger-api-bench-tool` - support for multiple streams [DPP-372] (#9691)
0f6f654 rotate release duty after 1.14.0-snapshot.20210518.6953.0.a6c7b86a (#9738)
123e142 release 1.14.0-snapshot.20210518.6953.0.a6c7b86a (#9737)
2dbfe43 Fix conversion of TryContextInfo in scenario service (#9731)
e375fef update NOTICES file (#9739)
```
Changelog:
```
[jdbc ledger] increase default hikari connection pool timeout to 2s from 250ms
- [Ledger HTTP Json Service] Logging output can now be in JSON either via providing the cli option `--log-encoder json` or via setting the env var `LOG_FORMAT_JSON=true`
- [Daml Standard Library] `assert`, `(===)`, and other assertion functions (see DA.Assert) now use a new `CanAssert` typeclass constraint instead of `CanAbort`, in preparation for exceptions support.
- [docs] The Daml ledger model has been updated to describe the changes introduced by the new exceptions feature. See  here: https://docs.daml.com/concepts/ledger-model/ledger-exceptions.html
- [Integration Kit] - Created the ledger-api-bench-tool prototype for benchmarking ledger transaction streaming capabilities
- [Integration Kit] - added metrics to the ledger-api-bench-tool
- [Integration Kit] - support for multiple streams in the ledger-api-bench-tool
```

CHANGELOG_BEGIN
CHANGELOG_END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants