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

Function check_station_deployment

tests/integration/src/control_panel_tests.rs:221–245  ·  view source on GitHub ↗
(env: &PocketIc, station_id: Principal, user_id: Principal)

Source from the content-addressed store, hash-verified

219}
220
221fn check_station_deployment(env: &PocketIc, station_id: Principal, user_id: Principal) {
222 // first get the upgrader canister ID
223 let system_info = get_system_info(env, user_id, station_id);
224 let upgrader_id = system_info.upgrader_id;
225 // now get the canister status from the management canister on behalf of the upgrader canister
226 // (note that only controllers can invoke the canister status management canister method)
227 let canister_status = env.canister_status(station_id, Some(upgrader_id)).unwrap();
228 // the control panel should set the newly deployed station's controllers
229 // to be the upgrader canister and the NNS root canister;
230 // assert that the set of controllers is equal to {upgrader_canister_id, NNS_ROOT_CANISTER_ID}
231 let station_controllers = canister_status.settings.controllers;
232 assert_eq!(station_controllers.len(), 2);
233 assert!(station_controllers.contains(&upgrader_id));
234 assert!(station_controllers.contains(&NNS_ROOT_CANISTER_ID));
235 assert_ne!(upgrader_id, NNS_ROOT_CANISTER_ID);
236
237 // stop the station and upgrader to get their cycles balance including reservations
238 env.stop_canister(upgrader_id, Some(station_id)).unwrap();
239 env.stop_canister(station_id, Some(upgrader_id)).unwrap();
240 // check the cycles balance of station and upgrader
241 let upgrader_cycles = env.cycle_balance(upgrader_id);
242 assert!((900_000_000_000..1_100_000_000_000).contains(&upgrader_cycles));
243 let station_cycles = env.cycle_balance(station_id);
244 assert!((900_000_000_000..1_100_000_000_000).contains(&station_cycles));
245}
246
247#[test]
248fn deploy_too_many_stations() {

Callers 2

deploy_user_stationFunction · 0.85

Calls 3

get_system_infoFunction · 0.85
stop_canisterMethod · 0.80
canister_statusMethod · 0.45

Tested by

no test coverage detected