/// This test assumes it's being executed using `config_memory_capacity`, which
/// limits the memory capacity of the subnet to 20MiB.
This test assumes it's being executed using `config_memory_capacity`, which
limits the memory capacity of the subnet to 20MiB.
This test assumes it ' s being executed using ` config_memory_capacity ` which limits the memory capacity of the subnet to 20MiB .
pub fn exceeding_memory_capacity_fails_when_memory_allocation_changes(
    handle: IcHandle,
    ctx: &ic_fondue::pot::Context,
) {
    let mut rng = ctx.rng.clone();
    let rt = tokio::runtime::Runtime::new().expect("Could not create tokio runtime.");
    rt.block_on({
        async move {
            let endpoint = get_random_node_endpoint(&handle, &mut rng);
            endpoint.assert_ready(ctx).await;
            let agent = assert_create_agent(endpoint.url.as_str()).await;
            // Create a canister for the user.
            let mgr = ManagementCanister::create(&agent);
            let canister_id = mgr
                .create_canister()
                .as_provisional_create_with_amount(None)
                .call_and_wait(delay())
                .await
                .expect("Couldn't create canister with provisional API.")
                .0;
            // Set the memory to 20MiB + 1. Should fail.
            let res = mgr
                .update_settings(&canister_id)
                .with_memory_allocation(20u64 * 1024 * 1024 + 1)
                .call_and_wait(delay())
                .await;
            assert_reject(res, RejectCode::SysFatal);
            // Set the memory to exactly 20MiB. Should succeed.
            mgr.update_settings(&canister_id)
                .with_memory_allocation(20u64 * 1024 * 1024)
                .call_and_wait(delay())
                .await
                .unwrap();
        }
    })
}
pub fn exceeding_memory_capacity_fails_when_memory_allocation_changes ( handle : IcHandle , ctx : & ic_fondue :: pot :: Context , ) { let mut rng = ctx . rng . clone ( ) ; let rt = tokio :: runtime :: Runtime :: new ( ) . expect ( " " ) ; rt . block_on ( { async move { let endpoint = get_random_node_endpoint ( & handle , & mut rng ) ; endpoint . assert_ready ( ctx ) . await ; let agent = assert_create_agent ( endpoint . url . as_str ( ) ) . await ; // Create a canister for the user. let mgr = ManagementCanister :: create ( & agent ) ; let canister_id = mgr . create_canister ( ) . as_provisional_create_with_amount ( None ) . call_and_wait ( delay ( ) ) . await . expect ( " " ) . 0 ; // Set the memory to 20MiB + 1. Should fail. let res = mgr . update_settings ( & canister_id ) . with_memory_allocation ( 20u64 * 1024 * 1024 + 1 ) . call_and_wait ( delay ( ) ) . await ; assert_reject ( res , RejectCode :: SysFatal ) ; // Set the memory to exactly 20MiB. Should succeed. mgr . update_settings ( & canister_id ) . with_memory_allocation ( 20u64 * 1024 * 1024 ) . call_and_wait ( delay ( ) ) . await . unwrap ( ) ; } } ) }
This test assumes it's being executed using `config_memory_capacity`, which
limits the memory capacity of the subnet to 20MiB.
This test assumes it ' s being executed using ` config_memory_capacity ` which limits the memory capacity of the subnet to 20MiB .
handle
IcHandle
ctx
&ic_fondue::pot::Context