(env: &PocketIc, station_id: Principal, user_id: Principal)
| 219 | } |
| 220 | |
| 221 | fn 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] |
| 248 | fn deploy_too_many_stations() { |
no test coverage detected