Skip to content

Commit

Permalink
Migrate integration tests to PocketIC (#2557)
Browse files Browse the repository at this point in the history
Migrates all II integration tests to PocketIC. Since the API for
obtaining the current timestamp changed, I took the opportunity to
make better use of the `time` helper in `framework`.
  • Loading branch information
frederikrothenberger authored Aug 22, 2024
1 parent 09e9544 commit 71f572e
Show file tree
Hide file tree
Showing 46 changed files with 2,120 additions and 507 deletions.
31 changes: 12 additions & 19 deletions .github/workflows/canister-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -246,16 +246,11 @@ jobs:
name: internet_identity_test.wasm.gz
path: .
- run: mv internet_identity_test.wasm.gz internet_identity.wasm.gz
- name: Download ic-test-state-machine binary
- name: Install PocketIC
run: |
uname_sys=$(uname -s | tr '[:upper:]' '[:lower:]')
echo "uname_sys: $uname_sys"
commit_sha=$(sed <.ic-commit 's/#.*$//' | sed '/^$/d')
echo "commit sha: $commit_sha"
curl -sLO "https://download.dfinity.systems/ic/$commit_sha/binaries/x86_64-$uname_sys/ic-test-state-machine.gz"
gzip -d ic-test-state-machine.gz
chmod a+x ic-test-state-machine
./ic-test-state-machine --version
curl -sL -o pocket-ic.gz https://github.com/dfinity/pocketic/releases/download/5.0.0/pocket-ic-x86_64-linux.gz
gzip -d pocket-ic.gz
chmod +x pocket-ic
- name: "Run VC issuer canister tests"
working-directory: demos/vc_issuer
run: |
Expand Down Expand Up @@ -344,7 +339,7 @@ jobs:
needs: [canister-tests-build, cached-build, docker-build-archive]
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
os: [ ubuntu-latest , macos-latest ]
partition: ['1/3', '2/3', '3/3']
steps:
- uses: actions/checkout@v4
Expand All @@ -359,16 +354,11 @@ jobs:
with:
name: canister-tests-${{ matrix.os }}.tar.zst
path: .
- name: Download ic-test-state-machine binary
- name: Install PocketIC
run: |
uname_sys=$(uname -s | tr '[:upper:]' '[:lower:]')
echo "uname_sys: $uname_sys"
commit_sha=$(sed <.ic-commit 's/#.*$//' | sed '/^$/d')
echo "commit sha: $commit_sha"
curl -sLO "https://download.dfinity.systems/ic/$commit_sha/binaries/x86_64-$uname_sys/ic-test-state-machine.gz"
gzip -d ic-test-state-machine.gz
chmod a+x ic-test-state-machine
./ic-test-state-machine --version
curl -sL -o pocket-ic.gz https://github.com/dfinity/pocketic/releases/download/5.0.0/pocket-ic-x86_64-${{ matrix.os == 'macos-latest' && 'darwin' || 'linux' }}.gz
gzip -d pocket-ic.gz
chmod +x pocket-ic
- name: 'Download II wasm'
uses: actions/download-artifact@v4
Expand All @@ -382,6 +372,9 @@ jobs:
name: archive.wasm.gz
path: .

- name: Run PocketIc
run: ./pocket-ic --port-file pocket-ic-port &

- name: Run Tests
run: |
mv internet_identity_test.wasm.gz internet_identity.wasm.gz
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ test-failures/
*.wasm
*.wasm.gz
ic-test-state-machine
pocket-ic

*.tsbuildinfo
Loading

0 comments on commit 71f572e

Please sign in to comment.