From 9142c9596fa9273f55bd7a6ceae7ca41f0e72b73 Mon Sep 17 00:00:00 2001 From: Severin Siffert Date: Tue, 13 Feb 2024 10:48:06 +0100 Subject: [PATCH 1/7] fix arg type in canister call --- extensions/nns/e2e/tests/nns.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/nns/e2e/tests/nns.bash b/extensions/nns/e2e/tests/nns.bash index ff637a31..a30f1253 100755 --- a/extensions/nns/e2e/tests/nns.bash +++ b/extensions/nns/e2e/tests/nns.bash @@ -156,7 +156,7 @@ assert_nns_canister_id_matches() { run dfx --identity ident-1 ledger transfer 4b37224c5ed36e8a28ae39af482f5f858104f0a2285d100e67cf029ff07d948e --amount 10 --memo 1414416717 assert_success - run dfx --identity ident-1 canister call rkp4c-7iaaa-aaaaa-aaaca-cai notify_mint_cycles '(record { block_index = 5; })' + run dfx --identity ident-1 canister call rkp4c-7iaaa-aaaaa-aaaca-cai notify_mint_cycles '(record { block_index = 5 : nat64; })' # If cycles ledger is configured correctly, then notify_mint_cycles will try to call the cycles ledger. # If it is not configured correctly, then this will complain about the cycles ledger canister id not being configured. assert_output --partial "Canister um5iw-rqaaa-aaaaq-qaaba-cai not found" From b5446028dc16353a704061c3fda753c4b8a678a9 Mon Sep 17 00:00:00 2001 From: Severin Siffert Date: Tue, 13 Feb 2024 10:50:43 +0100 Subject: [PATCH 2/7] rm unnecessary dfx stop --- extensions/nns/e2e/tests/nns.bash | 3 --- 1 file changed, 3 deletions(-) diff --git a/extensions/nns/e2e/tests/nns.bash b/extensions/nns/e2e/tests/nns.bash index a30f1253..d52859ea 100755 --- a/extensions/nns/e2e/tests/nns.bash +++ b/extensions/nns/e2e/tests/nns.bash @@ -160,9 +160,6 @@ assert_nns_canister_id_matches() { # If cycles ledger is configured correctly, then notify_mint_cycles will try to call the cycles ledger. # If it is not configured correctly, then this will complain about the cycles ledger canister id not being configured. assert_output --partial "Canister um5iw-rqaaa-aaaaq-qaaba-cai not found" - - echo Stopping dfx... - dfx stop } test_project_import() { From 0c9bae4b152631ba128ffe3bb04a9ee429908027 Mon Sep 17 00:00:00 2001 From: Severin Siffert Date: Tue, 13 Feb 2024 11:01:16 +0100 Subject: [PATCH 3/7] clarify comment --- extensions/nns/e2e/tests/nns.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/nns/e2e/tests/nns.bash b/extensions/nns/e2e/tests/nns.bash index d52859ea..901eea2e 100755 --- a/extensions/nns/e2e/tests/nns.bash +++ b/extensions/nns/e2e/tests/nns.bash @@ -157,7 +157,7 @@ assert_nns_canister_id_matches() { run dfx --identity ident-1 ledger transfer 4b37224c5ed36e8a28ae39af482f5f858104f0a2285d100e67cf029ff07d948e --amount 10 --memo 1414416717 assert_success run dfx --identity ident-1 canister call rkp4c-7iaaa-aaaaa-aaaca-cai notify_mint_cycles '(record { block_index = 5 : nat64; })' - # If cycles ledger is configured correctly, then notify_mint_cycles will try to call the cycles ledger. + # If cycles ledger is configured correctly, then notify_mint_cycles will try to call the cycles ledger (and fail because the canister is not even created). # If it is not configured correctly, then this will complain about the cycles ledger canister id not being configured. assert_output --partial "Canister um5iw-rqaaa-aaaaq-qaaba-cai not found" } From 4fe5bd763b9300243901144ae4c65792f8091df4 Mon Sep 17 00:00:00 2001 From: Severin Siffert Date: Tue, 13 Feb 2024 11:04:27 +0100 Subject: [PATCH 4/7] rm irrelevant tests --- extensions/nns/e2e/tests/nns.bash | 88 ------------------------------- 1 file changed, 88 deletions(-) diff --git a/extensions/nns/e2e/tests/nns.bash b/extensions/nns/e2e/tests/nns.bash index 901eea2e..23f45f38 100755 --- a/extensions/nns/e2e/tests/nns.bash +++ b/extensions/nns/e2e/tests/nns.bash @@ -162,91 +162,3 @@ assert_nns_canister_id_matches() { assert_output --partial "Canister um5iw-rqaaa-aaaaq-qaaba-cai not found" } -test_project_import() { - DFX_JSON_LOCATION="$1" - - # this test is meant to demonstrate that the various - dfx beta project import "$DFX_JSON_LOCATION" --prefix "pfx-" --network-mapping ic=mainnet --all - - jq . dfx.json - - run jq -r '.canisters."pfx-normal-canister".candid' dfx.json - assert_success - assert_output "candid/pfx-normal-canister.did" - # shellcheck disable=SC2154 - assert_files_eq \ - "${assets}/project-import/project-directory/normal-canister-directory/some-subdirectory/the-candid-filename.did" \ - "candid/pfx-normal-canister.did" - - run jq -r '.canisters."pfx-normal-canister".remote.id.ic' dfx.json - assert_success - assert_output "rrkah-fqaaa-aaaaa-aaaaq-cai" - - run jq -r '.canisters."pfx-sibling".candid' dfx.json - assert_success - assert_output "candid/pfx-sibling.did" - assert_files_eq \ - "${assets}/project-import/sibling-project/canister/canister/the-sibling-candid-definition.did" \ - "candid/pfx-sibling.did" -} - -@test "dfx project import from filesystem" { - test_project_import "${assets}/project-import/project-directory/dfx.json" -} - -@test "dfx project import from url" { - start_webserver --directory "${assets}/project-import" - - test_project_import "http://localhost:$E2E_WEB_SERVER_PORT/project-directory/dfx.json" -} - -test_project_import_specific_canister() { - LOCATION="$1" - - # this test is meant to demonstrate that the various - dfx beta project import "$LOCATION" normal-canister - - jq . dfx.json - - run jq -r '.canisters."normal-canister".candid' dfx.json - assert_success - assert_output "candid/normal-canister.did" - assert_files_eq \ - "${assets}/project-import/project-directory/normal-canister-directory/some-subdirectory/the-candid-filename.did" \ - "candid/normal-canister.did" - - run jq -r '.canisters.sibling.candid' dfx.json - assert_success - assert_output "null" -} - -@test "dfx project import specific canister" { - test_project_import_specific_canister "${assets}/project-import/project-directory/dfx.json" -} - -@test "import from url" { - start_webserver --directory "${assets}/project-import" - - test_project_import_specific_canister "http://localhost:$E2E_WEB_SERVER_PORT/project-directory/dfx.json" -} - -@test "project import from filesystem with no canister_ids.json" { - mkdir www - cp -R "${assets}/project-import" www/ - rm www/project-import/project-directory/canister_ids.json - - start_webserver --directory "www/project-import" - - dfx beta project import www/project-import/project-directory/dfx.json --all -} - -@test "project import from url with no canister_ids.json" { - mkdir www - cp -R "${assets}/project-import" www/ - rm www/project-import/project-directory/canister_ids.json - - start_webserver --directory "www/project-import" - - dfx beta project import "http://localhost:$E2E_WEB_SERVER_PORT/project-directory/dfx.json" --all -} - From 0934168d0ef8f497f8194ef81b02bfd38d530177 Mon Sep 17 00:00:00 2001 From: Severin Siffert Date: Tue, 13 Feb 2024 13:27:44 +0100 Subject: [PATCH 5/7] please dont help... --- extensions/nns/e2e/tests/nns.bash | 1 + 1 file changed, 1 insertion(+) diff --git a/extensions/nns/e2e/tests/nns.bash b/extensions/nns/e2e/tests/nns.bash index 23f45f38..c64f7d2d 100755 --- a/extensions/nns/e2e/tests/nns.bash +++ b/extensions/nns/e2e/tests/nns.bash @@ -154,6 +154,7 @@ assert_nns_canister_id_matches() { assert_success assert_output "$SECP256K1_ACCOUNT_ID" + sleep 60 # give proposal time to restart the canister run dfx --identity ident-1 ledger transfer 4b37224c5ed36e8a28ae39af482f5f858104f0a2285d100e67cf029ff07d948e --amount 10 --memo 1414416717 assert_success run dfx --identity ident-1 canister call rkp4c-7iaaa-aaaaa-aaaca-cai notify_mint_cycles '(record { block_index = 5 : nat64; })' From 31ac7a3783a07b1850ed4a933a9109b8cde7c7cb Mon Sep 17 00:00:00 2001 From: Severin Siffert Date: Tue, 13 Feb 2024 13:44:01 +0100 Subject: [PATCH 6/7] check if 10s wait is enough --- extensions/nns/e2e/tests/nns.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/nns/e2e/tests/nns.bash b/extensions/nns/e2e/tests/nns.bash index c64f7d2d..3f33568f 100755 --- a/extensions/nns/e2e/tests/nns.bash +++ b/extensions/nns/e2e/tests/nns.bash @@ -154,7 +154,7 @@ assert_nns_canister_id_matches() { assert_success assert_output "$SECP256K1_ACCOUNT_ID" - sleep 60 # give proposal time to restart the canister + sleep 10 # give proposal time to restart the canister run dfx --identity ident-1 ledger transfer 4b37224c5ed36e8a28ae39af482f5f858104f0a2285d100e67cf029ff07d948e --amount 10 --memo 1414416717 assert_success run dfx --identity ident-1 canister call rkp4c-7iaaa-aaaaa-aaaca-cai notify_mint_cycles '(record { block_index = 5 : nat64; })' From 49ccb743b915bd2a81130634c7905091a325b08b Mon Sep 17 00:00:00 2001 From: Severin Siffert Date: Tue, 13 Feb 2024 14:13:14 +0100 Subject: [PATCH 7/7] explain sleep --- extensions/nns/e2e/tests/nns.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/nns/e2e/tests/nns.bash b/extensions/nns/e2e/tests/nns.bash index 3f33568f..9edf52f3 100755 --- a/extensions/nns/e2e/tests/nns.bash +++ b/extensions/nns/e2e/tests/nns.bash @@ -154,7 +154,7 @@ assert_nns_canister_id_matches() { assert_success assert_output "$SECP256K1_ACCOUNT_ID" - sleep 10 # give proposal time to restart the canister + sleep 10 # In slow CI the last upgrade proposal has not finished executing yet. Need to give a little spare time to restart all canisters run dfx --identity ident-1 ledger transfer 4b37224c5ed36e8a28ae39af482f5f858104f0a2285d100e67cf029ff07d948e --amount 10 --memo 1414416717 assert_success run dfx --identity ident-1 canister call rkp4c-7iaaa-aaaaa-aaaca-cai notify_mint_cycles '(record { block_index = 5 : nat64; })'