Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run scenarios with CHC enabled #92

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
9d851bf
add chc-service nix package
c12i Aug 28, 2024
4ab6425
nix flake update
c12i Aug 29, 2024
8a58cbb
update holonix
c12i Sep 6, 2024
230fa4f
initial scenario setup
c12i Sep 6, 2024
5a28705
nix flake update
c12i Sep 9, 2024
8505e06
nix flake update
c12i Sep 11, 2024
3a51e5f
update conductor config
c12i Sep 11, 2024
5438ca5
update ci workflow
c12i Sep 11, 2024
a704319
update ci nixpkgs
c12i Sep 11, 2024
32f4077
add script to run sandbox conductor and chc service concurrently
c12i Sep 12, 2024
9287afb
run run.sh as a background process in ci
c12i Sep 12, 2024
ecbb71b
fix CI; only start chc service on write_read scenario
c12i Sep 16, 2024
7665694
wait for CHC service to be available before running sandbox
c12i Sep 16, 2024
0e098b4
split write_read scenarios
c12i Sep 17, 2024
d4e1cd8
revert inadvertedly removed newlines at the end of file
c12i Sep 17, 2024
6301aec
remove commented out chc_url from conductor config yaml files
c12i Sep 17, 2024
b550110
remove overridden holochain flake input
c12i Sep 17, 2024
96b0635
revert newlines in conductor config yaml file
c12i Sep 17, 2024
e145c02
run more scenarios with CHC enabled
c12i Sep 19, 2024
218d62b
Merge remote-tracking branch 'holochain/main' into holochain-chc-perf…
c12i Sep 19, 2024
21300d9
derive a with-chc conductor config and embed conditionally to base co…
c12i Sep 25, 2024
bc11dfb
Merge remote-tracking branch 'holochain/main' into holochain-chc-perf…
c12i Sep 26, 2024
adedffb
update workspace.nix
c12i Sep 26, 2024
7e0f152
Merge remote-tracking branch 'holochain/main' into holochain-chc-perf…
c12i Oct 29, 2024
6f84ccb
Remove some CHC test runs
c12i Oct 29, 2024
2a25434
Clean up embed_conductor_config
c12i Oct 29, 2024
c720e1b
Fix fmt
c12i Oct 29, 2024
b243b05
Fix nonCargoBuildFiles
c12i Oct 30, 2024
8c28d97
Update conductor-config
c12i Oct 31, 2024
a53b456
Enable the chc feature on holochain
c12i Oct 31, 2024
1ca424f
Merge remote-tracking branch 'holochain/main' into holochain-chc-perf…
c12i Oct 31, 2024
ade10a4
Add instruction for running the CHC service in the README
c12i Oct 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 113 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,19 @@ jobs:

pkill hc && pkill holochain && pkill lair-keystore

- name: Smoke test - dht_sync_lag with CHC enabled
run: |
# start the CHC reference implementation service
nix develop .#ci -c bash -c "hc-chc-service --port 8181 &"

# Start a sandbox conductor and run it in the background
nix develop .#ci -c bash -c "hc s clean && echo "1234" | hc s --piped create --chc-url http://localhost:8181 && 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

pkill hc && pkill holochain && pkill lair-keystore

- name: Smoke test - app_install
run: |
# Start a sandbox conductor and run it in the background
Expand Down Expand Up @@ -138,6 +151,22 @@ jobs:

pkill hc && pkill holochain && pkill lair-keystore

- name: Smoke test - write_read with CHC enabled
run: |
# start the CHC reference implementation service
nix develop .#ci -c bash -c "hc-chc-service --port 8181 &"

# wait for the CHC service to be available
sleep 2

# Start a sandbox conductor and run it in the background
nix develop .#ci -c bash -c "hc s clean && echo "1234" | hc s --piped create --chc-url http://localhost:8181 && 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

pkill hc && pkill holochain && pkill lair-keystore

- name: Smoke test - write_query
run: |
# Start a sandbox conductor and run it in the background
Expand All @@ -148,6 +177,19 @@ jobs:

pkill hc && pkill holochain && pkill lair-keystore

- name: Smoke test - write_query with CHC enabled
run: |
# start the CHC reference implementation service
nix develop .#ci -c bash -c "hc-chc-service --port 8181 &"

# Start a sandbox conductor and run it in the background
nix develop .#ci -c bash -c "hc s clean && echo "1234" | hc s --piped create --chc-url http://localhost:8181 && 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

pkill hc && pkill holochain && pkill lair-keystore

- name: Smoke test - local_signals
run: |
# Start a sandbox conductor and run it in the background
Expand All @@ -168,6 +210,19 @@ jobs:

pkill hc && pkill holochain && pkill lair-keystore

- name: Smoke test - write_validated with CHC enabled
run: |
# start the CHC reference implementation service
nix develop .#ci -c bash -c "hc-chc-service --port 8181 &"

# Start a sandbox conductor and run it in the background
nix develop .#ci -c bash -c "hc s clean && echo "1234" | hc s --piped create --chc-url http://localhost:8181 && echo "1234" | hc s --piped -f 8888 run &"

# Run the scenario for 5 seconds
RUST_LOG=info nix run .#write_validated -- --connection-string ws://localhost:8888 --duration 5 --no-progress

pkill hc && pkill holochain && pkill lair-keystore

- name: Smoke test - trycp_write_validated
run: |
set -x
Expand All @@ -185,6 +240,26 @@ jobs:
# Stop local network services
pkill hc-run-local

- name: Smoke test - trycp_write_validated with CHC enabled
run: |
set -x

# start the CHC reference implementation service
nix develop .#ci -c bash -c "hc-chc-service --port 8181 &"
c12i marked this conversation as resolved.
Show resolved Hide resolved

# Start local network services
nix develop .#ci -c bash -c "hc-run-local-services --bootstrap-port 4422 --signal-port 4423 &"
# Start a TryCP instance
nix develop .#ci -c bash -c "source ./scripts/trycp.sh && start_trycp &"

# Run the scenario for 10 seconds
RUST_LOG=warn CONDUCTOR_CONFIG="CI" CHC_ENABLED="1" MIN_PEERS=2 nix run .#trycp_write_validated -- --targets targets-ci.yaml --instances-per-target 2 --duration 10 --no-progress

# Stop the TryCP instance
nix develop .#ci -c bash -c "source ./scripts/trycp.sh && stop_trycp"
# Stop local network services
pkill hc-run-local

- name: Smoke test - remote_call_rate
run: |
set -x
Expand Down Expand Up @@ -217,6 +292,24 @@ jobs:
# Stop local network services
pkill hc-run-local

- name: Smoke test - two_party_countersigning with CHC enabled
run: |
# start the CHC reference implementation service
nix develop .#ci -c bash -c "hc-chc-service --port 8181 &"

# Start local network services
nix develop .#ci -c bash -c "hc-run-local-services --bootstrap-port 4422 --signal-port 4423 &"
# Start a TryCP instance
nix develop .#ci -c bash -c "source ./scripts/trycp.sh && start_trycp &"

# Run the scenario for 10 seconds
RUST_LOG=warn CONDUCTOR_CONFIG="CI" CHC_ENABLED="1" MIN_PEERS=2 nix run .#two_party_countersigning -- --targets targets-ci.yaml --behaviour initiate:1 --behaviour participate:1 --instances-per-target 2 --duration 10 --no-progress

# Stop the TryCP instance
nix develop .#ci -c bash -c "source ./scripts/trycp.sh && stop_trycp"
# Stop local network services
pkill hc-run-local

- name: Smoke test - validation_receipts
run: |
set -x
Expand Down Expand Up @@ -251,6 +344,26 @@ jobs:
# Stop local network services
pkill hc-run-local

- name: Smoke test - validation_receipts with CHC enabled
run: |
set -x

# start the CHC reference implementation service
nix develop .#ci -c bash -c "hc-chc-service --port 8181 &"

# Start local network services
nix develop .#ci -c bash -c "hc-run-local-services --bootstrap-port 4422 --signal-port 4423 &"
# Start a TryCP instance
nix develop .#ci -c bash -c "source ./scripts/trycp.sh && start_trycp &"

# Run the scenario for 10 seconds
RUST_LOG=warn CONDUCTOR_CONFIG="CI" CHC_ENABLED="1" MIN_PEERS=2 nix run .#validation_receipts -- --targets targets-ci.yaml --instances-per-target 2 --duration 10 --no-progress

# Stop the TryCP instance
nix develop .#ci -c bash -c "source ./scripts/trycp.sh && stop_trycp"
# Stop local network services
pkill hc-run-local

- name: Build scenario bundles
if: runner.os == 'Linux'
run: |
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,14 @@ You can then start a second terminal and run one of the scenarios in the `scenar
RUST_LOG=info CONDUCTOR_CONFIG="CI" TRYCP_RUST_LOG="info" MIN_PEERS=2 cargo run --package trycp_write_validated -- --targets targets-ci.yaml --instances-per-target 2 --duration 60
```

#### Running Scenarios with CHC Enabled

In order to run scenarios with chc enabled, you will need to run the [reference chc service](https://github.com/holochain/hc-chc-service) in a separate terminal window:

```bash
hc-chc-service --port 8181
```

### Published crates

Framework crates:
Expand Down
29 changes: 23 additions & 6 deletions bindings/trycp_runner/src/macros.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,31 @@
#[macro_export]
macro_rules! embed_conductor_config {
() => {
fn conductor_config() -> &'static str {
static CONDUCTOR_CONFIG: &str = include_str!("../../../conductor-config.yaml");
static CONDUCTOR_CONFIG_CI: &str = include_str!("../../../conductor-config-ci.yaml");
fn conductor_config() -> String {
static BASE_CONDUCTOR_CONFIG: &str =
include_str!("../../../conductor-config/conductor-config.yaml");
static BASE_CONDUCTOR_CONFIG_CI: &str =
include_str!("../../../conductor-config/conductor-config-ci.yaml");
static CHC_CONDUCTOR_CONFIG: &str =
include_str!("../../../conductor-config/with-chc.yaml");

match std::env::var("CONDUCTOR_CONFIG") {
Ok(value) if value == "CI" => CONDUCTOR_CONFIG_CI,
_ => CONDUCTOR_CONFIG,
let mut config = if std::env::var("CONDUCTOR_CONFIG")
.map(|value| value == "CI")
.unwrap_or(false)
{
BASE_CONDUCTOR_CONFIG_CI.to_owned()
} else {
BASE_CONDUCTOR_CONFIG.to_owned()
};

if std::env::var("CHC_ENABLED")
.map(|v| v == "1")
.unwrap_or(false)
{
config = format!("{}\n{}", config, CHC_CONDUCTOR_CONFIG);
}

config
}
};
}
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions conductor-config/with-chc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
chc_url: http://localhost:8181
74 changes: 35 additions & 39 deletions flake.lock

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

16 changes: 15 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@
};
};

chc-service = {
url = "github:holochain/hc-chc-service";
inputs = {
nixpkgs.follows = "nixpkgs";
crane.follows = "crane";
rust-overlay.follows = "rust-overlay";
holonix.follows = "holonix";
};
};

crane = {
url = "github:ipetkov/crane";
};
Expand Down Expand Up @@ -55,6 +65,8 @@
perSystem = { inputs', pkgs, system, config, ... }:
let
rustMod = flake-parts-lib.importApply ./nix/modules/rust.nix { inherit crane rust-overlay nixpkgs; };
cargoExtraArgs = "--features chc";
customHolochain = inputs'.holonix.packages.holochain.override { inherit cargoExtraArgs; };
in
{
imports = [
Expand All @@ -81,11 +93,12 @@
pkgs.taplo
pkgs.yamlfmt
pkgs.perl
customHolochain
config.rustHelper.rust
inputs'.holonix.packages.holochain
inputs'.holonix.packages.lair-keystore
inputs'.holonix.packages.hn-introspect
inputs'.tryorama.packages.trycp-server
inputs'.chc-service.packages.hc-chc-service
inputs'.amber.packages.default
] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
pkgs.darwin.apple_sdk.frameworks.Security
Expand All @@ -111,6 +124,7 @@
inputs'.holonix.packages.holochain
inputs'.holonix.packages.lair-keystore
inputs'.tryorama.packages.trycp-server
inputs'.chc-service.packages.hc-chc-service
];
};

Expand Down
Loading
Loading