Skip to content

Commit

Permalink
Merge pull request #3 from omnia-network/multiple-gw
Browse files Browse the repository at this point in the history
Support clients from multiple Gateways
  • Loading branch information
ilbertt authored Nov 21, 2023
2 parents 81413d9 + 969d767 commit 9ecb1ca
Show file tree
Hide file tree
Showing 27 changed files with 867 additions and 566 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
outputs:
version: ${{ steps.cargo-publish.outputs.version }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: "stable"
Expand All @@ -41,7 +41,7 @@ jobs:
version: ${{ steps.tag_version.outputs.new_tag }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
Expand All @@ -54,7 +54,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Release
uses: softprops/action-gh-release@v1
with:
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ on:
push:
branches:
- main
pull_request:

jobs:
unit-and-integration-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: "stable"
Expand All @@ -19,6 +20,9 @@ jobs:
cache-on-failure: "true"
- name: Run unit tests
run: cargo test --package ic-websocket-cdk --lib -- tests::unit_tests
- name: Run doc tests
run: cargo test --package ic-websocket-cdk --doc
# the following steps are replicated in the scripts/test.sh file
- name: Prepare environment for integration tests
run: |
rustup target add wasm32-unknown-unknown
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,17 @@ The **ic-websocket-cdk** library implementation can be found in the [src/ic-webs
### Testing

There are two types of tests available:
- **Unit tests**: tests for CDK functions, written in Rust.
- **Integration tests**: for these tests a local IC replica is set up and the CDK is deployed to a [test canister](./tests/src/lib.rs). Tests are written in Node.js and are available in the [tests](./tests/integration/) folder.
- **Unit tests**: tests for CDK functions, written in Rust and available in the [unit_tests](./src/ic-websocket-cdk/src/tests/unit_tests/) folder.
- **Integration tests**: for these tests the CDK is deployed to a [test canister](./src/test_canister/). These tests are written in Rust and use [PocketIC](https://github.com/dfinity/pocketic) under the hood. They are available in the [integration_tests](./src/ic-websocket-cdk/src/tests/integration_tests/) folder.

There's a script that runs all the tests together, taking care of setting up the replica and deploying the canister. To run the script, execute the following command:
There's a script that runs all the tests together, taking care of setting up the environment (Linux only!) and deploying the canister. To run the script, execute the following command:

```bash
./scripts/test_canister.sh
./scripts/test.sh
```

> If you're on **macOS**, you have to manually download the PocketIC binary ([guide](https://github.com/dfinity/pocketic#download)) and place it in the [bin](./bin/) folder.
## License

MIT License. See [LICENSE](./LICENSE).
Expand Down
15 changes: 15 additions & 0 deletions scripts/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -e

# unit tests
cargo test --package ic-websocket-cdk --lib -- tests::unit_tests
# doc tests
cargo test --package ic-websocket-cdk --doc

# integration tests
./scripts/download-pocket-ic.sh

./scripts/build-test-canister.sh

POCKET_IC_BIN="$(pwd)/bin/pocket-ic" RUST_BACKTRACE=1 cargo test --package ic-websocket-cdk --lib -- tests::integration_tests --test-threads 1
13 changes: 0 additions & 13 deletions scripts/test_canister.sh

This file was deleted.

Loading

0 comments on commit 9ecb1ca

Please sign in to comment.