diff --git a/service/pool/tests/actor_class/test.sh b/service/pool/tests/actor_class/test.sh index c6f1a59b..c5dd707d 100644 --- a/service/pool/tests/actor_class/test.sh +++ b/service/pool/tests/actor_class/test.sh @@ -7,9 +7,9 @@ let deleter = file(".dfx/local/canisters/Deleter/Deleter.wasm"); let S = install(wasm, null, opt 100_000_000_000_000); let nonce = record { timestamp = 1 : int; nonce = 1 : nat }; -let c1 = call S.getCanisterId(nonce); +let c1 = call S.getCanisterId(nonce, "test"); let args = record { arg = blob ""; wasm_module = parent; mode = variant { install }; canister_id = c1.id }; -call S.installCode(c1, args, false, false); +call S.installCode(c1, args, record { profiling = false; is_whitelisted = false; origin = "test" }); let c1 = c1.id; @@ -48,26 +48,26 @@ let init = opt record { let S = install(wasm, init, opt 100_000_000_000_000); let nonce = record { timestamp = 1 : int; nonce = 1 : nat }; -let c1 = call S.getCanisterId(nonce); +let c1 = call S.getCanisterId(nonce, "test"); let args = record { arg = blob ""; wasm_module = parent; mode = variant { install }; canister_id = c1.id }; -call S.installCode(c1, args, false, false); +call S.installCode(c1, args, record { profiling = false; is_whitelisted = false; origin = "test" }); let c1 = c1.id; fail call c1.makeChild(0); -call S.getCanisterId(nonce); -call S.getCanisterId(nonce); +call S.getCanisterId(nonce, "test"); +call S.getCanisterId(nonce, "test"); // Security check let S = install(wasm, null, opt 100_000_000_000_000); let nonce = record { timestamp = 1 : int; nonce = 1 : nat }; -let c1 = call S.getCanisterId(nonce); +let c1 = call S.getCanisterId(nonce, "test"); let args = record { arg = blob ""; wasm_module = parent; mode = variant { install }; canister_id = c1.id }; -call S.installCode(c1, args, false, false); +call S.installCode(c1, args, record { profiling = false; is_whitelisted = false; origin = "test" }); -let c2 = call S.getCanisterId(nonce); +let c2 = call S.getCanisterId(nonce, "test"); let args = record { arg = blob ""; wasm_module = deleter; mode = variant { install }; canister_id = c2.id }; -call S.installCode(c2, args, false, false); +call S.installCode(c2, args, record { profiling = false; is_whitelisted = false; origin = "test" }); let c1 = c1.id; let c2 = c2.id; diff --git a/service/pool/tests/canisterPool.test.sh b/service/pool/tests/canisterPool.test.sh index 2dbe7481..2a791365 100644 --- a/service/pool/tests/canisterPool.test.sh +++ b/service/pool/tests/canisterPool.test.sh @@ -14,7 +14,7 @@ let init = opt record { let S = install(wasm, init, null); let nonce = record { timestamp = 1 : int; nonce = 1 : nat }; let CID = call S.getCanisterId(nonce); -call S.installCode(CID, record { arg = blob ""; wasm_module = empty_wasm; mode = variant { install }; canister_id = CID.id }, false, false); +call S.installCode(CID, record { arg = blob ""; wasm_module = empty_wasm; mode = variant { install }; canister_id = CID.id }, record { profiling = false; is_whitelisted = false; origin = "test" }); metadata(CID.id, "module_hash"); // Immediately expire @@ -27,13 +27,13 @@ let init = opt record { }; let S = install(wasm, init, null); -let c1 = call S.getCanisterId(nonce); +let c1 = call S.getCanisterId(nonce, "test"); c1; -let c2 = call S.getCanisterId(nonce); +let c2 = call S.getCanisterId(nonce, "test"); c2; -let c3 = call S.getCanisterId(nonce); +let c3 = call S.getCanisterId(nonce, "test"); c3; -let c4 = call S.getCanisterId(nonce); +let c4 = call S.getCanisterId(nonce, "test"); c4; assert c1.id != c2.id; assert c1.id == c3.id; @@ -48,14 +48,14 @@ let init = opt record { max_family_tree_size = 5 : nat; }; reinstall(S, wasm, init); -let c3 = call S.getCanisterId(nonce); +let c3 = call S.getCanisterId(nonce, "test"); c3; -let c4 = call S.getCanisterId(nonce); +let c4 = call S.getCanisterId(nonce, "test"); c4; -fail call S.getCanisterId(nonce); +fail call S.getCanisterId(nonce, "test"); assert _ ~= "No available canister id"; call S.removeCode(c4); -call S.getCanisterId(nonce); +call S.getCanisterId(nonce, "test"); assert _.id == c4.id; assert _.timestamp != c4.timestamp; @@ -68,7 +68,7 @@ let init = opt record { max_family_tree_size = 5 : nat; }; let S = install(wasm, init, opt 100_000_000_000); -fail call S.getCanisterId(nonce); +fail call S.getCanisterId(nonce, "test"); assert _ ~= "105_000_000_000 cycles"; call ic.provisional_top_up_canister( record { @@ -76,7 +76,7 @@ call ic.provisional_top_up_canister( amount = 100_000_000_000_000; }, ); -call S.getCanisterId(nonce); +call S.getCanisterId(nonce, "test"); // Enough time has passed that the timer has removed the canister code fail metadata(CID.id, "module_hash"); diff --git a/service/pool/tests/nonce.test.sh b/service/pool/tests/nonce.test.sh index e327e162..bcb8e71a 100644 --- a/service/pool/tests/nonce.test.sh +++ b/service/pool/tests/nonce.test.sh @@ -13,11 +13,11 @@ let init = opt record { }; let S = install(wasm, init, null); -call S.getCanisterId(record { timestamp = 4780472194_000_000_000; nonce = 1 }); -fail call S.getCanisterId(record { timestamp = 4780472194_000_000_000; nonce = 1 }); +call S.getCanisterId(record { timestamp = 4780472194_000_000_000; nonce = 1 }, "test"); +fail call S.getCanisterId(record { timestamp = 4780472194_000_000_000; nonce = 1 }, "test"); assert _ ~= "Nonce already used"; -call S.getCanisterId(record { timestamp = 4780472194_000_000_001; nonce = 1 }); +call S.getCanisterId(record { timestamp = 4780472194_000_000_001; nonce = 1 }, "test"); identity bob; -fail call S.getCanisterId(record { timestamp = 4780472194_000_000_002; nonce = 1 }); +fail call S.getCanisterId(record { timestamp = 4780472194_000_000_002; nonce = 1 }, "test"); assert _ ~= "Proof of work check failed"; diff --git a/service/pool/tests/upgrade.test.sh b/service/pool/tests/upgrade.test.sh index 63044291..4826d3ef 100644 --- a/service/pool/tests/upgrade.test.sh +++ b/service/pool/tests/upgrade.test.sh @@ -13,15 +13,15 @@ let init = opt record { let S = install(wasm, init, null); let nonce = record { timestamp = 1 : int; nonce = 1 : nat }; -let c1 = call S.getCanisterId(nonce); +let c1 = call S.getCanisterId(nonce, "test"); c1; -let c2 = call S.getCanisterId(nonce); +let c2 = call S.getCanisterId(nonce, "test"); c2; upgrade(S, wasm, init); -let c3 = call S.getCanisterId(nonce); +let c3 = call S.getCanisterId(nonce, "test"); c3; -let c4 = call S.getCanisterId(nonce); +let c4 = call S.getCanisterId(nonce, "test"); c4; assert c1.id != c2.id; assert c1.id == c3.id; @@ -35,12 +35,16 @@ let init = opt record { canister_time_to_live = 3600_000_000_000 : nat; max_family_tree_size = 5 : nat; }; +let stats = call S.getStats(); upgrade(S, wasm, init); -let c5 = call S.getCanisterId(nonce); +// stats are preserved after upgrade +call S.getStats(); +assert _ == stats; +let c5 = call S.getCanisterId(nonce, "test"); c5; assert c5.id != c1.id; assert c5.id != c2.id; -fail call S.getCanisterId(nonce); +fail call S.getCanisterId(nonce, "test"); assert _ ~= "No available canister id"; // Cannot reduce pool @@ -54,5 +58,5 @@ let init = opt record { fail upgrade(S, wasm, init); assert _ ~= "Cannot reduce canisterPool for upgrade"; // still old canister, new TTL does not apply -fail call S.getCanisterId(nonce); +fail call S.getCanisterId(nonce, "test"); assert _ ~= "No available canister id";