Skip to content

Commit

Permalink
chore: merge formatting changes into 0.25 (#4111)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamspofford-dfinity authored Feb 18, 2025
1 parent 67656fd commit 6a6aabc
Show file tree
Hide file tree
Showing 52 changed files with 795 additions and 311 deletions.
27 changes: 13 additions & 14 deletions e2e/tests-dfx/assetscanister.bash
Original file line number Diff line number Diff line change
Expand Up @@ -905,14 +905,14 @@ check_permission_failure() {
dd if=/dev/urandom of=src/e2e_project_frontend/assets/asset2.bin bs=400000 count=1

dfx_start
assert_command dfx deploy
assert_command dfx deploy -v

assert_match '/asset1.bin 1/1'
assert_match '/asset2.bin 1/1'

dd if=/dev/urandom of=src/e2e_project_frontend/assets/asset2.bin bs=400000 count=1

assert_command dfx deploy
assert_command dfx deploy -v
assert_match '/asset1.bin.*is already installed'
assert_match '/asset2.bin 1/1'
}
Expand Down Expand Up @@ -1382,8 +1382,7 @@ EOF
echo '[]' > src/e2e_project_frontend/assets/.ic-assets.json5

assert_command dfx deploy
assert_contains "This project does not define a security policy for some assets."
assert_contains "Assets without any security policy: all"
assert_contains "This project does not define a security policy for any assets."
assert_command curl --fail --head "http://localhost:$PORT/thing.json?canisterId=$ID"
assert_not_match "content-security-policy"
assert_not_match "permissions-policy"
Expand Down Expand Up @@ -1414,7 +1413,7 @@ EOF
]' > src/e2e_project_frontend/assets/.ic-assets.json5

assert_command dfx deploy
assert_not_contains "This project does not define a security policy for some assets."
assert_not_contains "This project does not define a security policy for any assets."
assert_command curl --fail --head "http://localhost:$PORT/thing.json?canisterId=$ID"
assert_not_match "content-security-policy"
assert_not_match "permissions-policy"
Expand All @@ -1428,8 +1427,8 @@ EOF
]' > src/e2e_project_frontend/assets/.ic-assets.json5

assert_command dfx deploy
assert_not_contains "This project does not define a security policy for some assets."
assert_not_contains "This project uses the default security policy for some assets."
assert_not_contains "This project does not define a security policy for any assets."
assert_not_contains "This project uses the default security policy for all assets."
assert_command curl --fail --head "http://localhost:$PORT/thing.json?canisterId=$ID"
assert_not_match "content-security-policy"
assert_not_match "permissions-policy"
Expand All @@ -1443,8 +1442,8 @@ EOF
]' > src/e2e_project_frontend/assets/.ic-assets.json5

assert_command dfx deploy
assert_contains "This project uses the default security policy for some assets."
assert_contains "Unhardened assets: all"
assert_contains "This project uses the default security policy for all assets."
assert_not_contains "Unhardened assets:"
assert_command curl --fail --head "http://localhost:$PORT/thing.json?canisterId=$ID"
assert_match "content-security-policy"
assert_match "permissions-policy"
Expand Down Expand Up @@ -1480,7 +1479,7 @@ EOF
]' > src/e2e_project_frontend/assets/.ic-assets.json5

assert_command dfx deploy
assert_not_contains "This project uses the default security policy for some assets."
assert_not_contains "This project uses the default security policy for all assets."
assert_command curl --fail --head "http://localhost:$PORT/thing.json?canisterId=$ID"
assert_match "content-security-policy"
assert_match "permissions-policy"
Expand Down Expand Up @@ -1508,8 +1507,8 @@ EOF
]' > src/e2e_project_frontend/assets/.ic-assets.json5

assert_command dfx deploy
assert_not_contains "This project does not define a security policy for some assets."
assert_not_contains "This project uses the default security policy for some assets."
assert_not_contains "This project does not define a security policy for any assets."
assert_not_contains "This project uses the default security policy for all assets."
assert_command curl --fail --head "http://localhost:$PORT/thing.json?canisterId=$ID"
assert_match "content-security-policy: overwritten"
assert_match "permissions-policy"
Expand Down Expand Up @@ -1649,7 +1648,7 @@ EOF
assert_match "200 OK" "$stderr"

# redirect survives upgrade
assert_command dfx deploy --upgrade-unchanged
assert_command dfx deploy --upgrade-unchanged -v
assert_match "is already installed"

assert_command curl --fail -vv http://localhost:"$PORT"/test_alias_file.html?canisterId="$ID"
Expand Down Expand Up @@ -1922,7 +1921,7 @@ WARN: {
},
]' > src/e2e_project_frontend/assets/somedir/.ic-assets.json5

assert_command dfx deploy
assert_command dfx deploy -v
assert_match '/somedir/upload-me.txt 1/1 \(8 bytes\) sha [0-9a-z]* \(with cache and 1 header\)'
}

Expand Down
4 changes: 2 additions & 2 deletions e2e/tests-dfx/deploy.bash
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ teardown() {
(
cd src
assert_command dfx deploy
assert_match "Installing code for"
assert_match "Installed code for"
)

assert_command dfx canister call hello_backend greet '("Banzai")'
assert_eq '("Hello, Banzai!")'

assert_command dfx deploy
assert_not_match "Installing code for"
assert_not_match "Installed code for"
assert_match "is already installed"
}

Expand Down
5 changes: 2 additions & 3 deletions e2e/tests-dfx/error_context.bash
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,11 @@ teardown() {
PATH="$helpers_path" assert_command_fail "$dfx_path" deploy npm_missing

# expect to see the npm command line
assert_contains 'program: "npm"'
assert_match 'args: \[.*"npm".*"run".*"build".*\]'
assert_match 'npm run build'
# expect to see the name of the canister
assert_match "npm_missing"
# expect to see the underlying cause
assert_match "No such file or directory"
assert_match "(Is it installed?)"
}

@test "missing asset source directory" {
Expand Down
4 changes: 2 additions & 2 deletions e2e/tests-dfx/install.bash
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ teardown() {

assert_command dfx canister install --all

assert_match "Installing code for canister e2e_project_backend"
assert_match "Installed code for canister e2e_project_backend"
}

@test "install succeeds with network name" {
Expand All @@ -52,7 +52,7 @@ teardown() {

assert_command dfx canister install --all --network local

assert_match "Installing code for canister e2e_project_backend"
assert_match "Installed code for canister e2e_project_backend"
}

@test "install fails with network name that is not in dfx.json" {
Expand Down
18 changes: 9 additions & 9 deletions e2e/tests-dfx/mode_reinstall.bash
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ teardown() {
assert_command dfx canister install --mode=reinstall hello_backend

assert_match "YOU WILL LOSE ALL DATA IN THE CANISTER"
assert_match "Reinstalling code for canister hello_backend"
assert_match "Reinstalled code for canister hello_backend"
)
}

Expand All @@ -54,7 +54,7 @@ teardown() {

assert_match "YOU WILL LOSE ALL DATA IN THE CANISTER"

assert_not_match "Installing code for canister"
assert_not_match "Installed code for canister"
assert_contains "Refusing to install canister without approval"
assert_contains "User declined consent"
)
Expand All @@ -77,7 +77,7 @@ teardown() {
assert_command dfx deploy --mode=reinstall hello_backend

assert_match "YOU WILL LOSE ALL DATA IN THE CANISTER"
assert_match "Reinstalling code for canister hello_backend"
assert_match "Reinstalled code for canister hello_backend"
)
}

Expand All @@ -90,7 +90,7 @@ teardown() {

assert_match "YOU WILL LOSE ALL DATA IN THE CANISTER"

assert_not_match "Installing code for canister"
assert_not_match "Installed code for canister"
assert_contains "Refusing to install canister without approval"
assert_contains "User declined consent"
)
Expand Down Expand Up @@ -123,7 +123,7 @@ teardown() {
assert_match "You are about to reinstall the hello_frontend canister."
assert_not_match "You are about to reinstall the hello_backend canister."
assert_match "YOU WILL LOSE ALL DATA IN THE CANISTER"
assert_match "Reinstalling code for canister hello_frontend,"
assert_match "Reinstalled code for canister hello_frontend,"
)

# the hello_backend canister should not have been upgraded (which would reset the non-stable var)
Expand All @@ -141,24 +141,24 @@ teardown() {
assert_command dfx deploy --mode=reinstall hello_backend

assert_match "YOU WILL LOSE ALL DATA IN THE CANISTER"
assert_match "Reinstalling code for canister hello_backend"
assert_match "Reinstalled code for canister hello_backend"
)
echo y | (
assert_command dfx deploy --mode=reinstall hello_backend

assert_match "YOU WILL LOSE ALL DATA IN THE CANISTER"
assert_match "Reinstalling code for canister hello_backend"
assert_match "Reinstalled code for canister hello_backend"
)
echo YES | (
assert_command dfx deploy --mode=reinstall hello_backend

assert_match "YOU WILL LOSE ALL DATA IN THE CANISTER"
assert_match "Reinstalling code for canister hello_backend"
assert_match "Reinstalled code for canister hello_backend"
)
echo YeS | (
assert_command dfx deploy --mode=reinstall hello_backend

assert_match "YOU WILL LOSE ALL DATA IN THE CANISTER"
assert_match "Reinstalling code for canister hello_backend"
assert_match "Reinstalled code for canister hello_backend"
)
}
2 changes: 1 addition & 1 deletion e2e/tests-dfx/start.bash
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ teardown() {

@test "start and stop outside project" {
assert_command dfx_start
assert_contains "Success! The dfx server is running in the background."
assert_contains "Replica API running in the background"

mkdir subdir
cd subdir || exit 1
Expand Down
6 changes: 3 additions & 3 deletions e2e/tests-replica/deploy.bash
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ teardown() {
assert_command dfx canister create --all

assert_command dfx deploy
assert_match 'Installing code for canister'
assert_match 'Installed code for canister'
}

@test "dfx deploy supports arguments" {
Expand All @@ -85,13 +85,13 @@ teardown() {
# Therefore, there is no "attempting (install|upgrade)" message.

assert_command dfx deploy hello_backend
assert_match 'Installing code for canister'
assert_match 'Installed code for canister'

assert_command dfx canister call hello_backend greet '("First")'
assert_eq '("Hello, First!")'

assert_command dfx deploy hello_backend --upgrade-unchanged
assert_match 'Upgrading code for canister'
assert_match 'Upgraded code for canister'

assert_command dfx canister call hello_backend greet '("Second")'
assert_eq '("Hello, Second!")'
Expand Down
Loading

0 comments on commit 6a6aabc

Please sign in to comment.