Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: extension commands with extension defined canister type #4000

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading