pub fn canister_large_wasm_small_memory_allocation(
    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_application_node_endpoint(&handle, &mut rng);
            endpoint.assert_ready(ctx).await;
            let agent = assert_create_agent(endpoint.url.as_str()).await;
            let mgr = ManagementCanister::create(&agent);

            let canister_id = mgr
                .create_canister()
                .as_provisional_create_with_amount(None)
                .with_memory_allocation(1u64)
                .call_and_wait(delay())
                .await
                .expect("Couldn't create canister with provisional API.")
                .0;
            // Install a large wasm with a small memory allocation, it should fail.
            let res = mgr
                .install_code(&canister_id, UNIVERSAL_CANISTER_WASM)
                .call_and_wait(delay())
                .await;
            assert_reject(res, RejectCode::CanisterReject);
        }
    })
}
/// Try to install a canister with a large wasm but a small memory allocation.
/// It should be rejected.
Try to install a canister with a large wasm but a small memory allocation.
It should be rejected.
Try to install a canister with a large wasm but a small memory allocation . It should be rejected .
pub fn canister_large_wasm_small_memory_allocation(
    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_application_node_endpoint(&handle, &mut rng);
            endpoint.assert_ready(ctx).await;
            let agent = assert_create_agent(endpoint.url.as_str()).await;
            let mgr = ManagementCanister::create(&agent);
            let canister_id = mgr
                .create_canister()
                .as_provisional_create_with_amount(None)
                .with_memory_allocation(1u64)
                .call_and_wait(delay())
                .await
                .expect("Couldn't create canister with provisional API.")
                .0;
            // Install a large wasm with a small memory allocation, it should fail.
            let res = mgr
                .install_code(&canister_id, UNIVERSAL_CANISTER_WASM)
                .call_and_wait(delay())
                .await;
            assert_reject(res, RejectCode::CanisterReject);
        }
    })
}
pub fn canister_large_wasm_small_memory_allocation ( 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_application_node_endpoint ( & handle , & mut rng ) ; endpoint . assert_ready ( ctx ) . await ; let agent = assert_create_agent ( endpoint . url . as_str ( ) ) . await ; let mgr = ManagementCanister :: create ( & agent ) ; let canister_id = mgr . create_canister ( ) . as_provisional_create_with_amount ( None ) . with_memory_allocation ( 1u64 ) . call_and_wait ( delay ( ) ) . await . expect ( " " ) . 0 ; // Install a large wasm with a small memory allocation, it should fail. let res = mgr . install_code ( & canister_id , UNIVERSAL_CANISTER_WASM ) . call_and_wait ( delay ( ) ) . await ; assert_reject ( res , RejectCode :: CanisterReject ) ; } } ) }
Try to install a canister with a large wasm but a small memory allocation.
Try to install a canister with a large wasm but a small memory allocation .
handle
IcHandle
ctx
&ic_fondue::pot::Context
handle
IcHandle
ctx
&ic_fondue::pot::Context