-
Notifications
You must be signed in to change notification settings - Fork 98
feat: post-install actions #2266
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
Changes from 8 commits
0fc6010
a9a3421
bee3124
13040e6
23af40c
3a262b3
a889840
67f3b65
14c4290
c488fce
aaf1b0a
aa4e74e
cd5ae0c
d7c68e1
16e9d8f
f33c864
61f1826
4c0ebc5
9b5c003
47991a0
339f8dd
776ba75
62b63b3
65fa7b6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -81,3 +81,40 @@ teardown() { | |
| dfx canister create --all | ||
| assert_command_fail dfx canister install --all --wasm "${archive:?}/wallet/0.10.0/wallet.wasm" | ||
| } | ||
|
|
||
| @test "install runs post-install tasks" { | ||
| dfx_start | ||
| # shellcheck disable=SC2094 | ||
| cat <<<"$(jq '.canisters.e2e_project.post_install="sh -c \"echo hello\""' dfx.json)" >dfx.json | ||
|
|
||
| assert_command dfx canister create --all | ||
| assert_command dfx build | ||
|
|
||
| assert_command dfx canister install --all | ||
|
adamspofford-dfinity marked this conversation as resolved.
Outdated
|
||
| assert_match hello | ||
|
|
||
| # shellcheck disable=SC2094 | ||
| cat <<<"$(jq '.canisters.e2e_project.post_install=["sh -c \"echo hello\"", "sh -c \"return 1\""]' dfx.json)" >dfx.json | ||
| assert_command_fail dfx canister install --all --mode upgrade | ||
| assert_match hello | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you explain why "hello" is expected in the output here?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's expected because stdout is still printed; it's tested for to ensure that the script is why the command failed. |
||
| } | ||
|
|
||
| @test "post-install tasks receive environment variables" { | ||
| dfx_start | ||
| # shellcheck disable=SC2094 | ||
| cat <<<"$(jq '.canisters.e2e_project.post_install="sh -c \"echo hello $CANISTER_ID\""' dfx.json)" >dfx.json | ||
|
adamspofford-dfinity marked this conversation as resolved.
Outdated
|
||
|
|
||
| assert_command dfx canister create --all | ||
| assert_command dfx build | ||
| id=$(dfx canister id e2e_project) | ||
|
|
||
| assert_command dfx canister install --all | ||
| assert_match "hello $id" | ||
|
adamspofford-dfinity marked this conversation as resolved.
|
||
| assert_command dfx canister install e2e_project --mode upgrade | ||
| assert_match "hello $id" | ||
|
|
||
| assert_command dfx deploy | ||
| assert_match "hello $id" | ||
| assert_command dfx deploy e2e_project | ||
| assert_match "hello $id" | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.