Skip to content

Commit 0610e6b

Browse files
authored
Merge pull request #1062 from oggy-dfin/oggy/add-pocket-ic-to-parallel-calls-ci
chore: Add Pocket-IC tests to the parallel calls example CI
2 parents 2aff63a + 526f375 commit 0610e6b

File tree

6 files changed

+123
-45
lines changed

6 files changed

+123
-45
lines changed

.github/workflows/rust-parallel-calls-example.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,26 @@ jobs:
4242
dfx start --background
4343
make test
4444
popd
45+
rust-parallel-calls-pocket-ic-linux:
46+
runs-on: ubuntu-latest
47+
steps:
48+
- name: Checkout repository
49+
uses: actions/checkout@v2
50+
with:
51+
submodules: recursive
52+
- name: Provision Linux
53+
run: bash .github/workflows/provision-linux.sh
54+
- name: Install PocketIC server
55+
uses: dfinity/pocketic@main
56+
- name: Test parallel calls with PocketIC
57+
run: |
58+
pushd rust/parallel_calls
59+
cargo build --release --target wasm32-unknown-unknown -p callee
60+
cargo build --release --target wasm32-unknown-unknown -p caller
61+
export CALLER_WASM=$(cargo build --target wasm32-unknown-unknown -p caller --message-format=json \
62+
| jq -r 'select(.reason == "compiler-artifact") | .filenames[] | select(endswith(".wasm"))')
63+
export CALLEE_WASM=$(cargo build --target wasm32-unknown-unknown -p callee --message-format=json \
64+
| jq -r 'select(.reason == "compiler-artifact") | .filenames[] | select(endswith(".wasm"))')
65+
cargo run
66+
popd
67+

rust/parallel_calls/Cargo.lock

Lines changed: 93 additions & 41 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/parallel_calls/src/callee/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ crate-type = ["cdylib"]
1010

1111
[dependencies]
1212
candid = "0.10"
13-
ic-cdk = "0.15"
13+
ic-cdk = "0.17"

rust/parallel_calls/src/caller/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ crate-type = ["cdylib"]
1010

1111
[dependencies]
1212
candid = "0.10"
13-
ic-cdk = "0.15"
13+
ic-cdk = "0.17"
1414
futures = "0.3"

rust/parallel_calls/src/multi_subnet/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ edition = "2021"
66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
77

88
[dependencies]
9-
pocket-ic = "5.0.0"
9+
pocket-ic = "6.0.0"
1010
candid = "0.10"

rust/parallel_calls/src/multi_subnet/src/main.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use candid::{decode_one, encode_one, Principal};
22
use pocket_ic::{PocketIcBuilder, WasmResult};
33
use std::time::Instant;
44

5-
const INIT_CYCLES: u128 = 2_000_000_000_000;
5+
const INIT_CYCLES: u128 = 10_000_000_000_000;
66

77
fn main() {
88
let num_calls: u64 = 90;
@@ -58,6 +58,9 @@ fn main() {
5858
};
5959
let parallel_duration = parallel_start.elapsed();
6060

61+
assert_eq!(sequential_num_calls, num_calls, "Some sequential calls failed");
62+
assert_eq!(parallel_num_calls, num_calls, "Some parallel calls failed");
63+
6164
println!(
6265
"Sequential calls: {}/{} successful calls in {:?}",
6366
sequential_num_calls, num_calls, sequential_duration

0 commit comments

Comments
 (0)