Skip to content

Commit

Permalink
chore: run integration tests against PocketIC (#607)
Browse files Browse the repository at this point in the history
  • Loading branch information
mraszyk authored Nov 18, 2024
1 parent 03f8823 commit b95effb
Show file tree
Hide file tree
Showing 11 changed files with 423 additions and 68 deletions.
42 changes: 35 additions & 7 deletions .github/workflows/ic-ref.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
strategy:
matrix:
build: [linux-stable]
pocket-ic: ["replica", "pocketic"]
include:
- build: linux-stable
ic-hs-ref: "3d71032e"
Expand All @@ -28,7 +29,7 @@ jobs:
- name: Install dfx
uses: dfinity/setup-dfx@main
with:
dfx-version: "0.22.0-beta.0"
dfx-version: "0.24.2"

- name: Cargo cache
uses: actions/cache@v4
Expand All @@ -53,11 +54,20 @@ jobs:
- name: Run Integration Tests
run: |
set -ex
dfx start --background --clean
if [[ "${{ matrix.pocket-ic }}" == "replica" ]]
then
dfx start --background --clean
else
dfx start --background --clean --pocketic
fi
sleep 1
export IC_REF_PORT=$(dfx info replica-port)
export IC_REF_PORT=$(dfx info webserver-port)
export IC_UNIVERSAL_CANISTER_PATH=$HOME/canister.wasm
export IC_WALLET_CANISTER_PATH=$HOME/wallet.wasm
if [[ "${{ matrix.pocket-ic }}" == "pocketic" ]]
then
export POCKET_IC="http://localhost:${IC_REF_PORT}"
fi
cargo test --all-features -- --ignored
dfx stop
env:
Expand All @@ -79,11 +89,20 @@ jobs:
# create key:
pkcs11-tool -k --module $HSM_PKCS11_LIBRARY_PATH --login --slot-index $HSM_SLOT_INDEX -d $HSM_KEY_ID --key-type EC:prime256v1 --pin $HSM_PIN
dfx start --background --clean
if [[ "${{ matrix.pocket-ic }}" == "replica" ]]
then
dfx start --background --clean
else
dfx start --background --clean --pocketic
fi
sleep 1
export IC_REF_PORT=$(dfx info replica-port)
export IC_REF_PORT=$(dfx info webserver-port)
export IC_UNIVERSAL_CANISTER_PATH=$HOME/canister.wasm
export IC_WALLET_CANISTER_PATH=$HOME/wallet.wasm
if [[ "${{ matrix.pocket-ic }}" == "pocketic" ]]
then
export POCKET_IC="http://localhost:${IC_REF_PORT}"
fi
cd ref-tests
cargo test --all-features -- --ignored --nocapture --test-threads=1
dfx stop
Expand All @@ -98,9 +117,18 @@ jobs:
- name: Run Doc Tests
run: |
set -ex
dfx start --background --clean
if [[ "${{ matrix.pocket-ic }}" == "replica" ]]
then
dfx start --background --clean
else
dfx start --background --clean --pocketic
fi
sleep 1
export IC_REF_PORT=$(dfx info replica-port)
export IC_REF_PORT=$(dfx info webserver-port)
if [[ "${{ matrix.pocket-ic }}" == "pocketic" ]]
then
export POCKET_IC="http://localhost:${IC_REF_PORT}"
fi
cargo test --all-features --doc -- --ignored
dfx stop
env:
Expand Down
Loading

0 comments on commit b95effb

Please sign in to comment.