| 1320 | } |
| 1321 | |
| 1322 | pub(crate) fn upgrade_station( |
| 1323 | env: &PocketIc, |
| 1324 | user: Principal, |
| 1325 | station_id: Principal, |
| 1326 | name: Option<String>, |
| 1327 | ) { |
| 1328 | // upload chunks to asset canister |
| 1329 | let station_wasm = get_canister_wasm("station").to_vec(); |
| 1330 | let (base_chunk, module_extra_chunks) = |
| 1331 | upload_canister_chunks_to_asset_canister(env, station_wasm, 200_000); |
| 1332 | |
| 1333 | // create system upgrade request from chunks |
| 1334 | let station_init_arg = SystemInstall::Upgrade(SystemUpgrade { name }); |
| 1335 | let station_init_arg_bytes = Encode!(&station_init_arg).unwrap(); |
| 1336 | let system_upgrade_operation = |
| 1337 | RequestOperationInput::SystemUpgrade(SystemUpgradeOperationInput { |
| 1338 | target: SystemUpgradeTargetDTO::UpgradeStation, |
| 1339 | module: base_chunk, |
| 1340 | module_extra_chunks: Some(module_extra_chunks), |
| 1341 | arg: Some(station_init_arg_bytes), |
| 1342 | take_backup_snapshot: None, |
| 1343 | }); |
| 1344 | |
| 1345 | execute_request_with_extra_ticks( |
| 1346 | env, |
| 1347 | user, |
| 1348 | station_id, |
| 1349 | system_upgrade_operation, |
| 1350 | STATION_UPGRADE_EXTRA_TICKS, |
| 1351 | ) |
| 1352 | .unwrap(); |
| 1353 | } |