Skip to content

Commit

Permalink
Generate canister instead of committing a binary
Browse files Browse the repository at this point in the history
  • Loading branch information
adamspofford-dfinity committed Jan 17, 2024
1 parent c8d5f5e commit b874c44
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 5 deletions.
9 changes: 9 additions & 0 deletions e2e/assets/large_canister/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "large"
version = "0.0.0"
edition = "2021"

[lib]
crate-type = ["cdylib"]

[workspace]
7 changes: 3 additions & 4 deletions e2e/assets/large_canister/dfx.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"canisters": {
"large": {
"type": "custom",
"wasm": "large.wasm",
"candid": "large.did",
"build": []
"type": "rust",
"package": "large",
"candid": "large.did"
}
}
}
Binary file removed e2e/assets/large_canister/large.wasm
Binary file not shown.
2 changes: 2 additions & 0 deletions e2e/assets/large_canister/patch.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
head -c $((1024 * 1024 * 8)) /dev/urandom >garbage.bin
3 changes: 3 additions & 0 deletions e2e/assets/large_canister/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[toolchain]
channel = "stable"
targets = ["wasm32-unknown-unknown"]
3 changes: 3 additions & 0 deletions e2e/assets/large_canister/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#[used]
#[no_mangle]
pub static LARGE: &[u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/garbage.bin"));
2 changes: 1 addition & 1 deletion e2e/tests-dfx/install.bash
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ teardown() {
assert_command dfx build
assert_command dfx canister install --all
assert_command dfx canister info large
assert_match "Module hash: 0x$(sha2sum large.wasm | head -c 64)"
assert_match "Module hash: 0x$(sha2sum .dfx/local/canisters/large/large.wasm.gz | head -c 64)"
}

@test "--mode=auto selects install or upgrade automatically" {
Expand Down

0 comments on commit b874c44

Please sign in to comment.