-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from omnia-network/chore/migrate-tests-to-pocke…
…t-ic Migrate integration tests to pocket-ic
- Loading branch information
Showing
48 changed files
with
2,316 additions
and
27,184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,30 +11,18 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
cache: "npm" | ||
cache-dependency-path: "tests/package-lock.json" | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: 1.69.0 | ||
- uses: aviate-labs/[email protected] | ||
with: | ||
dfx-version: 0.14.1 | ||
toolchain: "stable" | ||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
cache-on-failure: "true" | ||
- name: Run unit tests | ||
run: cargo test | ||
- name: Install dependencies for integration tests | ||
run: cd tests && npm install | ||
run: cargo test -p ic-websocket-cdk | ||
- name: Prepare environment for integration tests | ||
run: | | ||
cd tests | ||
rustup target add wasm32-unknown-unknown | ||
dfx start --clean --background | ||
npm run deploy:tests | ||
npm run generate | ||
./scripts/download-pocket-ic.sh | ||
./scripts/build-test-canister.sh | ||
- name: Run integration tests | ||
run: cd tests && npm run test:integration | ||
run: POCKET_IC_BIN="$(pwd)/bin/pocket-ic" cargo test --package ic-websocket-cdk --lib -- tests::integration_tests --test-threads 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
[workspace] | ||
members = [ | ||
"src/ic-websocket-cdk", | ||
"tests", | ||
"src/test_canister", | ||
] | ||
resolver = "2" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../target/wasm32-unknown-unknown/release/test_canister.wasm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
cargo build --locked --target wasm32-unknown-unknown --release --package test_canister |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
cd bin/ | ||
|
||
POCKET_IC_BIN=pocket-ic | ||
if [ -f "$POCKET_IC_BIN" ]; then | ||
echo -e "$POCKET_IC_BIN exists. Path: $(pwd)/$POCKET_IC_BIN\n" | ||
else | ||
echo "$POCKET_IC_BIN does not exist." | ||
echo "Downloading Pocket IC binary..." | ||
curl -sLO https://download.dfinity.systems/ic/307d5847c1d2fe1f5e19181c7d0fcec23f4658b3/openssl-static-binaries/x86_64-linux/pocket-ic.gz | ||
|
||
echo "Extracting Pocket IC binary..." | ||
gzip -d $POCKET_IC_BIN.gz | ||
chmod +x $POCKET_IC_BIN | ||
|
||
echo -e "Pocket IC binary downloaded and extracted successfully! Path: $(pwd)/$POCKET_IC_BIN\n" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
type ClientPrincipal = principal; | ||
type ClientKey = record { | ||
client_principal : ClientPrincipal; | ||
client_nonce : nat64; | ||
}; | ||
|
||
type CanisterOpenMessageContent = record { | ||
client_key : ClientKey; | ||
}; | ||
|
||
type CanisterAckMessageContent = record { | ||
last_incoming_sequence_num : nat64; | ||
}; | ||
|
||
type ClientKeepAliveMessageContent = record { | ||
last_incoming_sequence_num : nat64; | ||
}; | ||
|
||
type WebsocketServiceMessageContent = variant { | ||
OpenMessage : CanisterOpenMessageContent; | ||
AckMessage : CanisterAckMessageContent; | ||
KeepAliveMessage : ClientKeepAliveMessageContent; | ||
}; |
Oops, something went wrong.