Skip to content

Commit

Permalink
Merge pull request #1062 from oggy-dfin/oggy/add-pocket-ic-to-paralle…
Browse files Browse the repository at this point in the history
…l-calls-ci

chore: Add Pocket-IC tests to the parallel calls example CI
  • Loading branch information
oggy-dfin authored Nov 28, 2024
2 parents 2aff63a + 526f375 commit 0610e6b
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 45 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/rust-parallel-calls-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,26 @@ jobs:
dfx start --background
make test
popd
rust-parallel-calls-pocket-ic-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: recursive
- name: Provision Linux
run: bash .github/workflows/provision-linux.sh
- name: Install PocketIC server
uses: dfinity/pocketic@main
- name: Test parallel calls with PocketIC
run: |
pushd rust/parallel_calls
cargo build --release --target wasm32-unknown-unknown -p callee
cargo build --release --target wasm32-unknown-unknown -p caller
export CALLER_WASM=$(cargo build --target wasm32-unknown-unknown -p caller --message-format=json \
| jq -r 'select(.reason == "compiler-artifact") | .filenames[] | select(endswith(".wasm"))')
export CALLEE_WASM=$(cargo build --target wasm32-unknown-unknown -p callee --message-format=json \
| jq -r 'select(.reason == "compiler-artifact") | .filenames[] | select(endswith(".wasm"))')
cargo run
popd
134 changes: 93 additions & 41 deletions rust/parallel_calls/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rust/parallel_calls/src/callee/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ crate-type = ["cdylib"]

[dependencies]
candid = "0.10"
ic-cdk = "0.15"
ic-cdk = "0.17"
2 changes: 1 addition & 1 deletion rust/parallel_calls/src/caller/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ crate-type = ["cdylib"]

[dependencies]
candid = "0.10"
ic-cdk = "0.15"
ic-cdk = "0.17"
futures = "0.3"
2 changes: 1 addition & 1 deletion rust/parallel_calls/src/multi_subnet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
pocket-ic = "5.0.0"
pocket-ic = "6.0.0"
candid = "0.10"
5 changes: 4 additions & 1 deletion rust/parallel_calls/src/multi_subnet/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use candid::{decode_one, encode_one, Principal};
use pocket_ic::{PocketIcBuilder, WasmResult};
use std::time::Instant;

const INIT_CYCLES: u128 = 2_000_000_000_000;
const INIT_CYCLES: u128 = 10_000_000_000_000;

fn main() {
let num_calls: u64 = 90;
Expand Down Expand Up @@ -58,6 +58,9 @@ fn main() {
};
let parallel_duration = parallel_start.elapsed();

assert_eq!(sequential_num_calls, num_calls, "Some sequential calls failed");
assert_eq!(parallel_num_calls, num_calls, "Some parallel calls failed");

println!(
"Sequential calls: {}/{} successful calls in {:?}",
sequential_num_calls, num_calls, sequential_duration
Expand Down

0 comments on commit 0610e6b

Please sign in to comment.