-
Notifications
You must be signed in to change notification settings - Fork 5
test(smoke): smoke test in rust #689
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
df9e000
test(smoke): smoke test in rust
iamquang95 b3edc04
refactor(smoke): simplify code and test
iamquang95 2e4687d
fix: pin commit hash
iamquang95 4605535
fix: doc
iamquang95 6db8a73
refactor: remove duration code
iamquang95 f45ba37
fix: lint
iamquang95 2ef1b18
Merge remote-tracking branch 'origin/main' into feat/fix-597
iamquang95 aaedd27
Drop Go packages
emlautarom1 2c90894
fix: update comments
iamquang95 f439edc
fix: address comments
iamquang95 ab044ac
Merge remote-tracking branch 'origin/feat/fix-597' into feat/fix-597
iamquang95 365eaec
Merge remote-tracking branch 'origin/main' into feat/fix-597
iamquang95 77b4d30
fix: pre-push test gate and p2p UDP address for smoke harness
iamquang95 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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,37 @@ | ||
| [package] | ||
| name = "pluto-test-compose" | ||
| description = "Docker-compose smoke-test harness for pluto and charon clusters. Test infrastructure, not shipped." | ||
| version.workspace = true | ||
| edition.workspace = true | ||
| repository.workspace = true | ||
| license.workspace = true | ||
| publish.workspace = true | ||
|
|
||
| [features] | ||
| smoke = [] | ||
|
|
||
| [[test]] | ||
| name = "smoke" | ||
| path = "tests/smoke.rs" | ||
| required-features = ["smoke"] | ||
|
|
||
| [dependencies] | ||
| k256.workspace = true | ||
| nix.workspace = true | ||
| pluto-eth2util.workspace = true | ||
| pluto-k1util.workspace = true | ||
| serde.workspace = true | ||
| serde_json.workspace = true | ||
| thiserror.workspace = true | ||
| tokio.workspace = true | ||
| tokio-util.workspace = true | ||
| tracing.workspace = true | ||
|
|
||
| [dev-dependencies] | ||
| tempfile.workspace = true | ||
| test-case.workspace = true | ||
| tokio = { workspace = true, features = ["test-util"] } | ||
| tracing-subscriber.workspace = true | ||
|
|
||
| [lints] | ||
| workspace = true |
This file contains hidden or 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,81 @@ | ||
| # Pluto Compose | ||
|
|
||
| Docker-compose smoke-test harness for pluto and charon clusters, adapted from | ||
| charon's `testutil/compose`. Test infrastructure: nothing here ships in the | ||
| `pluto` binary. | ||
|
|
||
| A cluster is produced in steps (`define` → `lock` → `run`), each | ||
| rewriting `docker-compose.yml` from `config.json`. `auto` chains the steps | ||
| against a docker daemon, brings the cluster up and watches Prometheus for | ||
| alerts. Nodes are charon or pluto per `node_impls`; key generation follows | ||
| `key_gen_impl`. | ||
|
|
||
| ## Smoke tests | ||
|
|
||
| `tests/smoke.rs` holds one test per scenario, named `scenario::<name>`, gated | ||
| behind the `smoke` feature so a plain `cargo test --workspace` never builds or | ||
| runs them. Each stands up a cluster for two minutes and fails on any firing | ||
| alert. Prerequisites: docker with compose v2, and `oas3-gen` from | ||
| `CONTRIBUTING.md` (the harness links `pluto-eth2util`, whose API types are | ||
| generated at build time). | ||
|
|
||
| ```bash | ||
| # one or more scenarios | ||
| PLUTO_REPO=$PWD cargo test -p pluto-test-compose --test smoke --features smoke -- --nocapture --exact scenario::default_alpha scenario::pluto_dkg | ||
| # the CI matrix (very_large needs a big machine) | ||
| cargo test -p pluto-test-compose --test smoke --features smoke -- --nocapture --test-threads=1 --skip scenario::very_large | ||
| # keep per-scenario logs | ||
| SMOKE_LOG_DIR=. cargo test -p pluto-test-compose --test smoke --features smoke -- --nocapture --exact scenario::default_alpha | ||
| ``` | ||
|
|
||
| Scenarios run one at a time whatever `--test-threads` says: a mutex in | ||
| `tests/smoke.rs` serializes them, since clusters competing for CPU and memory | ||
| produce duty timeouts a sequential run never sees. `--test-threads=1` only | ||
| keeps the output orderly. | ||
|
|
||
|
|
||
| | Variable | Effect | | ||
| | ---------------------- | ------------------------------------------------------------------------------------------------------- | | ||
| | `PLUTO_REPO` | Repository root the `pluto:local` image is built from. Scenarios that run pluto are skipped when unset. | | ||
| | `SMOKE_SUDO_PERMS` | Set to `1` when containers run as root, so the harness can `sudo chown` its artefacts. | | ||
| | `SMOKE_LOG_DIR` | Write `<dir>/<scenario>.log` with the `docker compose up` output. | | ||
| | `SMOKE_EXTERNAL_RELAY` | Use this relay URL instead of the in-cluster relay. | | ||
|
|
||
|
|
||
| The CI workflow (`.github/workflows/smoke-tests.yml`) is manual-only and runs | ||
| the same command. | ||
|
|
||
| ## Alert criteria vs. charon | ||
|
|
||
| Adapted from charon's `testutil/compose` alert rules, but the gate is corrected and the | ||
| criteria calibrated to actually fire: charon's collector matches Prometheus alert state | ||
| `"active"`, which is never emitted (only `inactive` / `pending` / `firing`), so upstream | ||
| nothing is ever gated. This harness matches `"firing"`, so several rules necessarily differ: | ||
|
|
||
|
|
||
| | Rule | Charon v1.7.1 | Pluto | Change & why | | ||
| | -------------------------- | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | | ||
| | `Pluto Down` | `up == 0` | `up == 0` | identical | | ||
| | `Validator API Error Rate` | `increase(…{endpoint!="proxy"}[30s]) > 1` | same | identical | | ||
| | `Proxy API Error Rate` | `increase(…{endpoint="proxy"}[30s]) > 5` | same | identical | | ||
| | `Warn Log Rate` | `increase(app_log_warn_total[30s]) > 2` | same + `{topic!~"vmock|tracker"}` | exclude charon mock-noise topics (vmock has no builder-registration handler; the beacon mock never includes broadcasts on-chain) | | ||
| | `Error Log Rate` | `app_log_error_total > 0` | `increase(app_log_error_total[30s]) > 0` | windowed — an absolute counter can't recover from the inherent cold-start consensus timeout (mock-VC startup delay → no randao); a window + warmup can | | ||
| | `Broadcast Duty Rate` | `increase(core_bcast_broadcast_total[30s]) < 0.5` | `(sum by (job) (increase(…{job=~"node[0-9]+"}[30s])) or on (job) max by (job) (0 * up)) < 0.5` | per-node sum + absent-series fallback, so a node emitting *no* broadcast series fails (charon's per-series form missed it) | | ||
| | `Outstanding Duty Rate` | `core_bcast_broadcast_total − core_scheduler_duty_total > 50` | *removed* | dead rule — a duty is broadcast at most as often as scheduled, so it can never be positive | | ||
| | *gate (alert state)* | `"active"` — never emitted | `"firing"` + readiness wait + 60s warmup allowlist | charon's gate is vacuous; pluto's enforces | | ||
|
|
||
|
|
||
| Scenarios that intentionally degrade the cluster tune the gate via config, not the code: | ||
|
|
||
|
|
||
| | Config knob | Effect | Used by | | ||
| | --------------------- | --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | | ||
| | `alert_exclude_jobs` | exempt a node from the per-node rules (never from `Pluto Down`) | `node_1_of_4_down`, `node_1_of_3_down` | | ||
| | `alert_disable_rules` | drop an entire rule | `node_1_of_3_down` (disables the error-rate gates — a downed round-1 leader makes every third proposer duty unrecoverable on the mock) | | ||
|
|
||
|
|
||
|
|
||
|
|
||
| ## Versioning | ||
|
|
||
| The charon image tag is `CHARON_IMAGE_TAG` in `src/smoke.rs`. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.