MCPcopy Create free account
hub / github.com/dfinity/orbit / do_failed_system_upgrade

Function do_failed_system_upgrade

tests/integration/src/system_upgrade_tests.rs:89–132  ·  view source on GitHub ↗
(
    env: &PocketIc,
    canister_ids: &CanisterIds,
    system_upgrade_operation: RequestOperationInput,
    expected_reason: &str,
)

Source from the content-addressed store, hash-verified

87}
88
89fn do_failed_system_upgrade(
90 env: &PocketIc,
91 canister_ids: &CanisterIds,
92 system_upgrade_operation: RequestOperationInput,
93 expected_reason: &str,
94) {
95 // check if station is healthy
96 let health_status =
97 get_core_canister_health_status(env, WALLET_ADMIN_USER, canister_ids.station);
98 assert_eq!(health_status, HealthStatus::Healthy);
99
100 let system_info = get_system_info(env, WALLET_ADMIN_USER, canister_ids.station);
101 assert!(system_info.raw_rand_successful);
102 let last_uprade_timestamp = system_info.last_upgrade_timestamp;
103
104 // submit invalid station upgrade request
105 // extra ticks are necessary to prevent polling on the request status
106 // before the station canister has been restarted
107 let request_status = execute_request_with_extra_ticks(
108 env,
109 WALLET_ADMIN_USER,
110 canister_ids.station,
111 system_upgrade_operation,
112 STATION_UPGRADE_EXTRA_TICKS,
113 )
114 .unwrap_err()
115 .unwrap();
116
117 // check that the station upgrade request is failed
118 match request_status {
119 RequestStatusDTO::Failed { reason } => assert!(reason.unwrap().contains(expected_reason)),
120 _ => panic!("Unexpected request status: {request_status:?}"),
121 };
122
123 // check the station status after the failed upgrade
124 let health_status =
125 get_core_canister_health_status(env, WALLET_ADMIN_USER, canister_ids.station);
126 assert_eq!(health_status, HealthStatus::Healthy);
127
128 // the last upgrade timestamp did not change after a failed upgrade
129 let system_info = get_system_info(env, WALLET_ADMIN_USER, canister_ids.station);
130 assert!(system_info.raw_rand_successful);
131 assert_eq!(last_uprade_timestamp, system_info.last_upgrade_timestamp);
132}
133
134#[test]
135fn failed_station_upgrade() {

Callers 4

failed_station_upgradeFunction · 0.85
too_many_chunksFunction · 0.85
too_large_wasmFunction · 0.85

Calls 3

get_system_infoFunction · 0.85

Tested by

no test coverage detected