Skip to content

Commit

Permalink
test: extension commands with extension defined canister type (#4000)
Browse files Browse the repository at this point in the history
Also use newer nns extension version

Part of https://dfinity.atlassian.net/browse/SDK-1832
  • Loading branch information
ericswanson-dfinity authored Nov 18, 2024
1 parent c97f641 commit fc14680
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 4 deletions.
2 changes: 1 addition & 1 deletion e2e/tests-dfx/cycles-ledger.bash
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ teardown() {
start_and_install_nns() {
dfx_start_for_nns_install

dfx extension install nns --version 0.4.3
dfx extension install nns --version 0.4.7
dfx nns install --ledger-accounts "$(dfx ledger account-id --identity cycle-giver)"
}

Expand Down
54 changes: 51 additions & 3 deletions e2e/tests-dfx/extension.bash
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,54 @@ teardown() {
standard_teardown
}

@test "run an extension command with a canister type defined by another extension" {
install_shared_asset subnet_type/shared_network_settings/system
dfx_start_for_nns_install

install_asset wasm/identity
CACHE_DIR=$(dfx cache show)
mkdir -p "$CACHE_DIR"/extensions/embera
cat > "$CACHE_DIR"/extensions/embera/extension.json <<EOF
{
"name": "embera",
"version": "0.1.0",
"homepage": "https://github.com/dfinity/dfx-extensions",
"authors": "DFINITY",
"summary": "Test extension for e2e purposes.",
"categories": [],
"keywords": [],
"canister_type": {
"evaluation_order": [ "wasm" ],
"defaults": {
"type": "custom",
"build": [
"echo the embera build step for canister {{canister_name}} with candid {{canister.candid}} and main file {{canister.main}} and gzip is {{canister.gzip}}",
"mkdir -p .embera/{{canister_name}}",
"cp main.wasm {{canister.wasm}}"
],
"gzip": true,
"wasm": ".embera/{{canister_name}}/{{canister_name}}.wasm"
}
}
}
EOF
cat > dfx.json <<EOF
{
"canisters": {
"c1": {
"type": "embera",
"candid": "main.did",
"main": "main-file.embera"
}
}
}
EOF

dfx extension install nns --version 0.4.7
dfx nns install
}


@test "extension canister type" {
dfx_start

Expand Down Expand Up @@ -187,14 +235,14 @@ install_extension_from_dfx_extensions_repo() {
assert_command dfx extension list
assert_match 'No extensions installed'

assert_command dfx extension install "$EXTENSION" --install-as snsx --version 0.2.1
assert_contains "Extension 'sns' version 0.2.1 installed successfully, and is available as 'snsx'"
assert_command dfx extension install "$EXTENSION" --install-as snsx --version 0.4.7
assert_contains "Extension 'sns' version 0.4.7 installed successfully, and is available as 'snsx'"

assert_command dfx extension list
assert_match 'snsx'

assert_command dfx --help
assert_match 'snsx.*Toolkit for'
assert_match 'snsx.*Initialize, deploy and interact with an SNS'

assert_command dfx snsx --help

Expand Down

0 comments on commit fc14680

Please sign in to comment.