From b67c71de6fca88c039fd529365c62828f551e894 Mon Sep 17 00:00:00 2001 From: Hamish Peebles Date: Thu, 5 Dec 2024 16:25:07 +0000 Subject: [PATCH] Fix logging of events migrated to stable memory + fix test (#6992) --- .../community/impl/src/lifecycle/post_upgrade.rs | 4 ++-- .../src/communities/delete_channel_tests.rs | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/backend/canisters/community/impl/src/lifecycle/post_upgrade.rs b/backend/canisters/community/impl/src/lifecycle/post_upgrade.rs index 6f87c4af23..f0989508dc 100644 --- a/backend/canisters/community/impl/src/lifecycle/post_upgrade.rs +++ b/backend/canisters/community/impl/src/lifecycle/post_upgrade.rs @@ -23,10 +23,10 @@ fn post_upgrade(args: Args) { assert!(data.members_migrated_to_stable_memory); - data.events.migrate_to_stable_memory(); - canister_logger::init_with_logs(data.test_mode, errors, logs, traces); + data.events.migrate_to_stable_memory(); + let env = init_env(data.rng_seed); init_state(env, data, args.wasm_version); diff --git a/backend/integration_tests/src/communities/delete_channel_tests.rs b/backend/integration_tests/src/communities/delete_channel_tests.rs index a98966b63e..1393f7dc5f 100644 --- a/backend/integration_tests/src/communities/delete_channel_tests.rs +++ b/backend/integration_tests/src/communities/delete_channel_tests.rs @@ -66,8 +66,8 @@ fn stable_memory_garbage_collected_after_deleting_channel() { } = init_test_data(env, canister_ids, *controller); let stable_map = get_stable_memory_map(env, community_id, STABLE_MEMORY_MAP_MEMORY_ID); - // 10 keys = 2 community members, 2 events and 2 users per channel - assert_eq!(stable_map.len(), 10); + // 11 keys = 1 community event, 2 community members, 2 chat events and 2 users per channel + assert_eq!(stable_map.len(), 11); for _ in 0..100 { client::community::happy_path::send_text_message(env, &user1, community_id, channel_id1, None, random_string(), None); @@ -75,7 +75,7 @@ fn stable_memory_garbage_collected_after_deleting_channel() { assert_eq!( get_stable_memory_map(env, community_id, STABLE_MEMORY_MAP_MEMORY_ID).len(), - 110 + 111 ); for _ in 0..80 { @@ -84,7 +84,7 @@ fn stable_memory_garbage_collected_after_deleting_channel() { assert_eq!( get_stable_memory_map(env, community_id, STABLE_MEMORY_MAP_MEMORY_ID).len(), - 190 + 191 ); client::community::happy_path::delete_channel(env, user1.principal, community_id, channel_id1); @@ -94,7 +94,7 @@ fn stable_memory_garbage_collected_after_deleting_channel() { assert_eq!( get_stable_memory_map(env, community_id, STABLE_MEMORY_MAP_MEMORY_ID).len(), - 86 + 87 ); client::community::happy_path::delete_channel(env, user1.principal, community_id, channel_id2); @@ -102,7 +102,7 @@ fn stable_memory_garbage_collected_after_deleting_channel() { env.advance_time(Duration::from_secs(60)); env.tick(); - assert_eq!(get_stable_memory_map(env, community_id, STABLE_MEMORY_MAP_MEMORY_ID).len(), 2); + assert_eq!(get_stable_memory_map(env, community_id, STABLE_MEMORY_MAP_MEMORY_ID).len(), 3); } fn init_test_data(env: &mut PocketIc, canister_ids: &CanisterIds, controller: Principal) -> TestData {