Skip to content

Commit

Permalink
Integrate trycp for multi node testing (#46)
Browse files Browse the repository at this point in the history
* Add trycp server

* Add trycp client wrapper

* Format

* Make script consistent with existing

* Clippy

* Allow agents to fail independently

* Skeleton TryCp test

* Smoke test on CI

* Support no happs required

* Source script before running command

* Update doc

* Review changes

* Pipeline improvements

* Try sweep with nix config set
  • Loading branch information
ThetaSinner authored Jun 5, 2024
1 parent 79d7e08 commit 854329a
Show file tree
Hide file tree
Showing 32 changed files with 2,058 additions and 73 deletions.
57 changes: 44 additions & 13 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,36 @@ jobs:
extraPullNames: holochain-ci
authToken: ${{ secrets.CACHIX_HOLOCHAIN_WIND_TUNNEL }}

- uses: actions/cache@v4
with:
path: |
.cargo/bin/
.cargo/registry/index/
.cargo/registry/cache/
.cargo/git/db/
target/
wasm-target/
key: "${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}"

- name: Cargo sweep mark for files
run: |
nix develop -c bash -c "cargo install cargo-sweep && cargo sweep --time 5"
- name: Check scripts
run: |
nix develop --command bash -c "shellcheck scripts/*.sh"
nix develop -c bash -c "shellcheck scripts/*.sh"
- name: Check Nix formatting
run: |
nix develop .#ci --command bash -c "source ./scripts/checks.sh && check_nix_fmt"
nix develop .#ci -c bash -c "source ./scripts/checks.sh && check_nix_fmt"
- name: Lint Nix
run: |
nix develop .#ci --command bash -c "source ./scripts/checks.sh && check_nix_static"
nix develop .#ci -c bash -c "source ./scripts/checks.sh && check_nix_static"
- name: Check Rust formatting
run: |
nix develop .#ci --command bash -c "source ./scripts/checks.sh && check_rust_fmt"
nix develop .#ci -c bash -c "source ./scripts/checks.sh && check_rust_fmt"
- name: Build and unit tests
run: |
Expand All @@ -61,12 +76,12 @@ jobs:
- name: Lint Rust
run: |
# Currently the only check is clippy, could bundle the other checks into the flake and remove the steps above?
nix flake check
nix flake check --all-systems
- name: Smoke test - zome_call_single_value
run: |
# Start a sandbox conductor and run it in the background
nix develop --command bash -c "hc s clean && echo "1234" | hc s --piped create && echo "1234" | hc s --piped -f 8888 run &"
nix develop -c bash -c "hc s clean && echo "1234" | hc s --piped create && echo "1234" | hc s --piped -f 8888 run &"
# TODO using `localhost` is resolving to an IPv6 address, but why is that giving a connection refused?
# Run the scenario for 5 seconds
Expand All @@ -77,7 +92,7 @@ jobs:
- name: Smoke test - single_write_many_read
run: |
# Start a sandbox conductor and run it in the background
nix develop --command bash -c "hc s clean && echo "1234" | hc s --piped create && echo "1234" | hc s --piped -f 8888 run &"
nix develop -c bash -c "hc s clean && echo "1234" | hc s --piped create && echo "1234" | hc s --piped -f 8888 run &"
# Run the scenario for 5 seconds
RUST_LOG=info nix run .#single_write_many_read -- --connection-string ws://localhost:8888 --duration 5 --no-progress
Expand All @@ -87,7 +102,7 @@ jobs:
- name: Smoke test - dht_sync_lag
run: |
# Start a sandbox conductor and run it in the background
nix develop --command bash -c "hc s clean && echo "1234" | hc s --piped create && echo "1234" | hc s --piped -f 8888 run &"
nix develop -c bash -c "hc s clean && echo "1234" | hc s --piped create && echo "1234" | hc s --piped -f 8888 run &"
# Run the scenario for 5 seconds
RUST_LOG=info nix run .#dht_sync_lag -- --connection-string ws://localhost:8888 --agents 2 --behaviour write:1 --behaviour record_lag:1 --duration 5 --no-progress
Expand All @@ -97,7 +112,7 @@ jobs:
- name: Smoke test - app_install
run: |
# Start a sandbox conductor and run it in the background
nix develop --command bash -c "hc s clean && echo "1234" | hc s --piped create && echo "1234" | hc s --piped -f 8888 run &"
nix develop -c bash -c "hc s clean && echo "1234" | hc s --piped create && echo "1234" | hc s --piped -f 8888 run &"
# Run the scenario for 5 seconds
RUST_LOG=info nix run .#app_install -- --connection-string ws://localhost:8888 --agents 2 --behaviour minimal:1 --behaviour large:1 --duration 5 --no-progress
Expand All @@ -107,7 +122,7 @@ jobs:
- name: Smoke test - first_call
run: |
# Start a sandbox conductor and run it in the background
nix develop --command bash -c "hc s clean && echo "1234" | hc s --piped create && echo "1234" | hc s --piped -f 8888 run &"
nix develop -c bash -c "hc s clean && echo "1234" | hc s --piped create && echo "1234" | hc s --piped -f 8888 run &"
# Run the scenario for 5 seconds
RUST_LOG=info nix run .#first_call -- --connection-string ws://localhost:8888 --agents 1 --behaviour local:1 --duration 5 --no-progress
Expand All @@ -117,7 +132,7 @@ jobs:
- name: Smoke test - write_read
run: |
# Start a sandbox conductor and run it in the background
nix develop --command bash -c "hc s clean && echo "1234" | hc s --piped create && echo "1234" | hc s --piped -f 8888 run &"
nix develop -c bash -c "hc s clean && echo "1234" | hc s --piped create && echo "1234" | hc s --piped -f 8888 run &"
# Run the scenario for 5 seconds
RUST_LOG=info nix run .#write_read -- --connection-string ws://localhost:8888 --duration 5 --no-progress
Expand All @@ -127,7 +142,7 @@ jobs:
- name: Smoke test - write_query
run: |
# Start a sandbox conductor and run it in the background
nix develop --command bash -c "hc s clean && echo "1234" | hc s --piped create && echo "1234" | hc s --piped -f 8888 run &"
nix develop -c bash -c "hc s clean && echo "1234" | hc s --piped create && echo "1234" | hc s --piped -f 8888 run &"
# Run the scenario for 5 seconds
RUST_LOG=info nix run .#write_query -- --connection-string ws://localhost:8888 --duration 5 --no-progress
Expand All @@ -137,13 +152,29 @@ jobs:
- name: Smoke test - local_signals
run: |
# Start a sandbox conductor and run it in the background
nix develop --command bash -c "hc s clean && echo "1234" | hc s --piped create && echo "1234" | hc s --piped -f 8888 run &"
nix develop -c bash -c "hc s clean && echo "1234" | hc s --piped create && echo "1234" | hc s --piped -f 8888 run &"
# Run the scenario for 5 seconds
RUST_LOG=info nix run .#local_signals -- --connection-string ws://localhost:8888 --duration 5 --no-progress
pkill --echo hc && pkill --echo holochain && pkill --echo lair-keystore
- name: Smoke test - remote_call
run: |
# Start a sandbox conductor and run it in the background
nix develop -c bash -c "hc s clean && echo "1234" | hc s --piped create && echo "1234" | hc s --piped -f 8888 run &"
# Start a TryCP instance
nix develop -c bash -c "source ./scripts/trycp.sh && start_trycp"
# Run the scenario for 5 seconds
RUST_LOG=info nix run .#remote_call -- --targets targets-ci.yaml --duration 5 --no-progress
# Stop the TryCP instance
nix develop -c bash -c "source ./scripts/trycp.sh && stop_trycp"
pkill --echo hc && pkill --echo holochain && pkill --echo lair-keystore
- name: Build scenario bundles
run: |
set -euxo pipefail
Expand Down
Loading

0 comments on commit 854329a

Please sign in to comment.