Fix trigger compat test for canton sandbox (#12549)

This fixes the timeout on trigger compat tests for the new sandbox (with LF >= 1.14).

The issue was that the trigger was "readAs"-ing with a party that
doesn't exist, since party ids aren't predictable with the new sandbox.

The solution is to allocate the Alice party ahead of time, and then
pass the allocated party in when calling `daml trigger`.

changelog_begin
changelog_end
This commit is contained in:
Sofia Faro 2022-01-24 12:24:33 +00:00 committed by GitHub
parent 3ea8aded13
commit 8692d80b33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 3 deletions

View File

@ -144,10 +144,21 @@ canonicalize_rlocation() {{
runner=$$(canonicalize_rlocation $(rootpath {runner}))
# Cleanup the trigger runner process but maintain the script runner exit code.
trap 'status=$$?; kill -TERM $$PID; wait $$PID; exit $$status' INT TERM
SCRIPTOUTPUT=$$(mktemp -d)
$$runner script \\
--ledger-host localhost \\
--ledger-port 6865 \\
--wall-clock-time \\
--dar $$(canonicalize_rlocation $(rootpath {dar})) \\
--script-name TestScript:allocateAlice \\
--output-file $$SCRIPTOUTPUT/alice.json
ALICE=$$(cat $$SCRIPTOUTPUT/alice.json | sed 's/"//g')
rm -rf $$SCRIPTOUTPUT
$$runner trigger \\
--ledger-host localhost \\
--ledger-port 6865 \\
--ledger-party Alice \\
--ledger-party $$ALICE \\
--wall-clock-time \\
--dar $$(canonicalize_rlocation $(rootpath {dar})) \\
--trigger-name CopyTrigger:copyTrigger &

View File

@ -8,10 +8,24 @@ import DA.Assert
import DA.Time
import Daml.Script
allocateAlice : Script Party
allocateAlice = do
debug "Creating Alice ..."
alice <- allocatePartyWithHint "Alice" (PartyIdHint "Alice")
debug alice
debug "... done"
pure alice
test : Script ()
test = do
debug "Creating parties ..."
alice <- allocatePartyWithHint "Alice" (PartyIdHint "Alice")
debug "Searching for Alice ..."
let isAlice x = displayName x == Some "Alice"
Some aliceDetails <- find isAlice <$> listKnownParties
let alice = party aliceDetails
debug alice
debug "... done"
debug "Creating Bob ..."
bob <- allocatePartyWithHint "Bob" (PartyIdHint "Bob")
debug alice
debug bob