-
Notifications
You must be signed in to change notification settings - Fork 305
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tests): use process-compose for smoke tests
Containers are out, process orchestration is in. A while back we ditched using containers for the smoke tests, mostly because the caching on the container-build story was atrocious, so test re-runs took a really long time. And frankly, container ergonomics on dev workstations, particularly macOS, are not awesome. Instead, let's assume the dev env can run processes for cargo, pd, and cometbft. If so, that's all we need to wire up our integration testing. Enter process-compose [0]. The new smoke test setup ditches the bash script and delegates to process-compose for orchestrating processes. Benchmarking via hyperfine shows a decrease of over 2x in runtime. There's one substantive change to the integration test logic, in the pcli suite, that reduces the sleep time between tests, refining it to be more precisely the duration necessary for claiming an undelegation. [0] https://github.com/F1bonacc1/process-compose
- Loading branch information
Showing
6 changed files
with
167 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
--- | ||
# A process-compose configuration for running penumbra smoke-tests. | ||
# | ||
# https://github.com/F1bonacc1/process-compose/ | ||
# | ||
version: "0.5" | ||
|
||
# Env vars set here will be accessible to all processes. | ||
environment: | ||
- "PENUMBRA_NODE_PD_URL=http://127.0.0.1:8080" | ||
- "PCLI_UNLEASH_DANGER=yes" | ||
- "EPOCH_DURATION=50" | ||
- "UNBONDING_DELAY=50" | ||
- "RUST_LOG=info,network_integration=debug,pclientd=debug,pcli=info,pd=info,penumbra=info" | ||
|
||
log_level: info | ||
is_strict: true | ||
# Interleave logs from all services in single file, so it's greppable. | ||
log_location: deployments/logs/smoke-combined.log | ||
|
||
processes: | ||
# Build latest version of local code. We do this once, up front, | ||
# so that each test suite runs immediately when ready, without iterative building. | ||
build-code: | ||
command: |- | ||
echo "Building source code before running tests..." | ||
cargo --quiet build --release --all-targets | ||
cargo --quiet test --release --no-run | ||
cargo --quiet test --release --no-run -- --ignored | ||
cargo --quiet test --release --features sct-divergence-check --package pclientd --no-run -- \ | ||
--ignored --test-threads 1 --nocapture | ||
cargo --quiet test --release --features sct-divergence-check,download-proving-keys --package pcli --no-run -- \ | ||
--ignored --test-threads 1 --nocapture | ||
cargo --quiet test --release --package pd --no-run -- \ | ||
--ignored --test-threads 1 --nocapture | ||
# Create network configuration, for running a pd validator locally. | ||
network-generate: | ||
command: > | ||
cargo run --quiet --release --bin pd -- | ||
testnet generate --unbonding-delay 50 | ||
--epoch-duration 50 --timeout-commit 500ms --gas-price-simple 1000 | ||
depends_on: | ||
build-code: | ||
condition: process_completed_successfully | ||
|
||
# Run pd validator based on generated network. | ||
pd: | ||
command: "cargo run --release --bin pd -- start" | ||
readiness_probe: | ||
http_get: | ||
host: 127.0.0.1 | ||
scheme: http | ||
path: "/" | ||
port: 8080 | ||
period_seconds: 5 | ||
depends_on: | ||
network-generate: | ||
condition: process_completed_successfully | ||
|
||
# Run CometBFT for pd p2p. | ||
cometbft: | ||
command: "cometbft --home ~/.penumbra/testnet_data/node0/cometbft start" | ||
depends_on: | ||
pd: | ||
condition: process_healthy | ||
|
||
# Run `pd` integration tests. | ||
test-pd: | ||
command: >- | ||
cargo test --release --package pd -- --ignored --test-threads 1 --nocapture | ||
depends_on: | ||
pd: | ||
condition: process_healthy | ||
cometbft: | ||
condition: process_started | ||
availability: | ||
restart: exit_on_failure | ||
|
||
# Run `pclientd` integration tests. | ||
test-pclientd: | ||
command: >- | ||
cargo test --release --features sct-divergence-check --package pclientd -- | ||
--ignored --test-threads 1 --nocapture | ||
log_location: deployments/logs/smoke-test-pclientd.log | ||
depends_on: | ||
pd: | ||
condition: process_healthy | ||
cometbft: | ||
condition: process_started | ||
test-pd: | ||
condition: process_completed | ||
availability: | ||
restart: exit_on_failure | ||
|
||
# Run `pcli` integration tests. | ||
test-pcli: | ||
command: >- | ||
cargo test --release --features sct-divergence-check,download-proving-keys --package pcli -- | ||
--ignored --test-threads 1 --nocapture | ||
log_location: deployments/logs/smoke-test-pcli.log | ||
depends_on: | ||
pd: | ||
condition: process_healthy | ||
cometbft: | ||
condition: process_started | ||
test-pclientd: | ||
condition: process_completed | ||
availability: | ||
restart: exit_on_failure | ||
|
||
# Finalizer task, which will wait until all test suites have finished. | ||
# This allows us to ensure that. | ||
summary: | ||
# The `command` only runs if all tests were succesful, | ||
# otherwise the process exits due to dep failure. | ||
command: echo tests finished | ||
depends_on: | ||
test-pd: | ||
condition: process_completed_successfully | ||
test-pclientd: | ||
condition: process_completed_successfully | ||
test-pcli: | ||
condition: process_completed_successfully | ||
availability: | ||
exit_on_end: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
smoke: | ||
# resetting network state | ||
cargo run --release --bin pd -- testnet unsafe-reset-all || true | ||
./deployments/scripts/smoke-test.sh |