Skip to content

feat: move integration tests#1174

Merged
JesseTheRobot merged 5 commits into
masterfrom
feat/chain-tests-crate
Mar 4, 2026
Merged

feat: move integration tests#1174
JesseTheRobot merged 5 commits into
masterfrom
feat/chain-tests-crate

Conversation

@JesseTheRobot

@JesseTheRobot JesseTheRobot commented Mar 2, 2026

Copy link
Copy Markdown
Member

Describe the changes
Moves tests currently in chain/tests to chain-tests/src, to avoid the problems with integration tests and cfg!(test)

Checklist

  • Tests have been added/updated for the changes.
  • Documentation has been updated for the changes (if applicable).
  • The code follows Rust's style guidelines.

Summary by CodeRabbit

  • Chores

    • Added a new dedicated test crate to centralize test utilities and test-only features.
    • Removed many dev-only dependencies to simplify build configuration.
    • Adjusted tooling flow so formatting and clippy fix steps run with consistent flags and conditional checks.
  • Refactor

    • Reorganized test module layout: moved many test modules into the new test crate and removed their public re-exports.
    • Tightened visibility of multiple helper/test functions to crate scope.

@coderabbitai

coderabbitai Bot commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 195d248 and fb4bd68.

📒 Files selected for processing (1)
  • crates/chain-tests/src/utils.rs

📝 Walkthrough

Walkthrough

This PR extracts tests into a new crate crates/chain-tests, adds it to the workspace, re-wires many test module declarations into that crate (mostly pub(crate)), tightens visibility of numerous test helpers, removes corresponding public test re-exports from crates/chain/tests, and prunes dev-dependencies from crates/chain/Cargo.toml.

Changes

Cohort / File(s) Summary
Workspace manifest
Cargo.toml
Added crates/chain-tests to workspace members.
New test crate manifest & root
crates/chain-tests/Cargo.toml, crates/chain-tests/src/lib.rs
Introduces crates/chain-tests crate with workspace-based dependencies, features (nvidia, telemetry), a public utils module, and many #[cfg(test)] test module declarations.
Chain crate manifest edits
crates/chain/Cargo.toml
Removed many workspace = true dependency entries and deleted the entire [dev-dependencies] block.
API & helper visibility reductions
crates/chain-tests/src/api/mod.rs, crates/chain-tests/src/validation/mod.rs, crates/chain-tests/src/block_production/unpledge_refund.rs, crates/chain-tests/src/packing/remote_packing.rs
Changed multiple helpers/tests from pub to pub(crate) (endpoint helpers and test utilities).
New test module wiring (chain-tests)
crates/chain-tests/src/...
crates/chain-tests/src/block_production/mod.rs, .../data_sync/mod.rs, .../integration/mod.rs, .../multi_node/mod.rs, .../packing/mod.rs, .../partition_assignments/mod.rs, .../programmable_data/mod.rs, .../promotion/mod.rs, .../startup/mod.rs
Added many crate-visible and private submodule declarations to compose the new test crate (analytics, block production submodules, multi-node tests, remote_packing, sm_reassignment_tests, programmable_data/basic, promotion tests, startup tests, etc.).
Removed test re-exports from original crate
crates/chain/tests/...
crates/chain/tests/mod.rs, crates/chain/tests/block_production/mod.rs, crates/chain/tests/data_sync/mod.rs, crates/chain/tests/integration/mod.rs, crates/chain/tests/multi_node/mod.rs, crates/chain/tests/packing/mod.rs, crates/chain/tests/partition_assignments/mod.rs, crates/chain/tests/programmable_data/mod.rs, crates/chain/tests/promotion/mod.rs, crates/chain/tests/startup/mod.rs
Deleted many public test module declarations and re-exports from crates/chain/tests, removing those test submodules from the original crate's public test namespace.
xtask adjustments
xtask/src/main.rs
Adjusted formatting/clippy flow: removed separate cargo fix pass, run cargo fmt and cargo clippy --fix with RUSTFLAGS; made some LocalChecks verification conditional on fix.
Minor docs/test tweaks
crates/chain-tests/src/utils.rs
Changed doctest fenced block to ignore to disable doctest execution in the example.

Sequence Diagram(s)

(Skipped — changes are reorganizational and do not introduce new multi-component runtime control flow.)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • antouhou
  • DanMacDonald
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: move integration tests' accurately describes the primary change: relocating tests from chain/tests to chain-tests/src to resolve cfg!(test) issues.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/chain-tests-crate

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@crates/chain-tests/src/packing/remote_packing.rs`:
- Around line 34-38: Replace the bare #[tokio::test] attribute on the async test
function packing_worker_full_node_test with the tracing-aware macro attribute
#[test_log::test(tokio::test)] so tracing (RUST_LOG + initialize_tracing()) is
captured correctly; locate the packing_worker_full_node_test definition and
update its attribute accordingly and leave the existing RUST_LOG set and
initialize_tracing() calls in place.

ℹ️ Review info

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 852c5a6 and 18b17ba.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (101)
  • Cargo.toml
  • crates/chain-tests/Cargo.toml
  • crates/chain-tests/src/api/api.rs
  • crates/chain-tests/src/api/client.rs
  • crates/chain-tests/src/api/external_api.rs
  • crates/chain-tests/src/api/hardfork_tests.rs
  • crates/chain-tests/src/api/mod.rs
  • crates/chain-tests/src/api/pricing_endpoint.rs
  • crates/chain-tests/src/api/supply_endpoint.rs
  • crates/chain-tests/src/api/tx.rs
  • crates/chain-tests/src/api/tx_commitments.rs
  • crates/chain-tests/src/api/tx_duplicates.rs
  • crates/chain-tests/src/block_production/analytics.rs
  • crates/chain-tests/src/block_production/basic_contract.rs
  • crates/chain-tests/src/block_production/block_index.rs
  • crates/chain-tests/src/block_production/block_production.rs
  • crates/chain-tests/src/block_production/block_rebuilding.rs
  • crates/chain-tests/src/block_production/block_validation.rs
  • crates/chain-tests/src/block_production/difficulty_adjustment.rs
  • crates/chain-tests/src/block_production/mod.rs
  • crates/chain-tests/src/block_production/reset_seed.rs
  • crates/chain-tests/src/block_production/test_double_spend.rs
  • crates/chain-tests/src/block_production/testing_primitives.rs
  • crates/chain-tests/src/block_production/treasury_tracking.rs
  • crates/chain-tests/src/block_production/unpledge_refund.rs
  • crates/chain-tests/src/block_production/unstake_refund.rs
  • crates/chain-tests/src/data_sync/mod.rs
  • crates/chain-tests/src/data_sync/sync_partition_data_tests.rs
  • crates/chain-tests/src/ema_pricing/ema_pricing.rs
  • crates/chain-tests/src/ema_pricing/mod.rs
  • crates/chain-tests/src/external/api.rs
  • crates/chain-tests/src/external/block_production.rs
  • crates/chain-tests/src/external/mod.rs
  • crates/chain-tests/src/external/programmable_data_basic.rs
  • crates/chain-tests/src/external/readme.md
  • crates/chain-tests/src/external/sync_partition_data_remote.rs
  • crates/chain-tests/src/external/utils/api.rs
  • crates/chain-tests/src/external/utils/client.rs
  • crates/chain-tests/src/external/utils/mod.rs
  • crates/chain-tests/src/external/utils/monitoring.rs
  • crates/chain-tests/src/external/utils/signer.rs
  • crates/chain-tests/src/external/utils/transactions.rs
  • crates/chain-tests/src/external/utils/types.rs
  • crates/chain-tests/src/external/utils/utils.rs
  • crates/chain-tests/src/integration/cache_service.rs
  • crates/chain-tests/src/integration/data_size.rs
  • crates/chain-tests/src/integration/mod.rs
  • crates/chain-tests/src/lib.rs
  • crates/chain-tests/src/multi_node/api_ingress_validation.rs
  • crates/chain-tests/src/multi_node/ema_forks.rs
  • crates/chain-tests/src/multi_node/epoch_replay.rs
  • crates/chain-tests/src/multi_node/fork_recovery.rs
  • crates/chain-tests/src/multi_node/fork_recovery_epoch.rs
  • crates/chain-tests/src/multi_node/mempool_tests.rs
  • crates/chain-tests/src/multi_node/mod.rs
  • crates/chain-tests/src/multi_node/peer_discovery.rs
  • crates/chain-tests/src/multi_node/peer_mining.rs
  • crates/chain-tests/src/multi_node/reth_restart.rs
  • crates/chain-tests/src/multi_node/sync_chain_state.rs
  • crates/chain-tests/src/multi_node/validation.rs
  • crates/chain-tests/src/packing/mod.rs
  • crates/chain-tests/src/packing/remote_packing.rs
  • crates/chain-tests/src/partition_assignments/mod.rs
  • crates/chain-tests/src/partition_assignments/sm_reassignment_tests.rs
  • crates/chain-tests/src/programmable_data/basic.rs
  • crates/chain-tests/src/programmable_data/mod.rs
  • crates/chain-tests/src/promotion/data_promotion_basic.rs
  • crates/chain-tests/src/promotion/data_promotion_double.rs
  • crates/chain-tests/src/promotion/mod.rs
  • crates/chain-tests/src/promotion/promotion_with_multiple_proofs.rs
  • crates/chain-tests/src/startup/auto_stake.rs
  • crates/chain-tests/src/startup/genesis.rs
  • crates/chain-tests/src/startup/mod.rs
  • crates/chain-tests/src/startup/startup.rs
  • crates/chain-tests/src/synchronization/mod.rs
  • crates/chain-tests/src/term_ledger_expiry/mod.rs
  • crates/chain-tests/src/term_ledger_expiry/perm_refund.rs
  • crates/chain-tests/src/utils.rs
  • crates/chain-tests/src/validation/blobs_rejected.rs
  • crates/chain-tests/src/validation/data_tx_pricing.rs
  • crates/chain-tests/src/validation/ingress_proof_reanchor_dedup.rs
  • crates/chain-tests/src/validation/ingress_proof_validation.rs
  • crates/chain-tests/src/validation/invalid_perm_fee_refund.rs
  • crates/chain-tests/src/validation/ledger_expiry_with_unstake.rs
  • crates/chain-tests/src/validation/mempool_gossip_shape.rs
  • crates/chain-tests/src/validation/mempool_ingress_proof_dedup.rs
  • crates/chain-tests/src/validation/mod.rs
  • crates/chain-tests/src/validation/poa_cases.rs
  • crates/chain-tests/src/validation/unpledge_partition.rs
  • crates/chain-tests/src/validation/unstake_edge_cases.rs
  • crates/chain/Cargo.toml
  • crates/chain/tests/block_production/mod.rs
  • crates/chain/tests/data_sync/mod.rs
  • crates/chain/tests/integration/mod.rs
  • crates/chain/tests/mod.rs
  • crates/chain/tests/multi_node/mod.rs
  • crates/chain/tests/packing/mod.rs
  • crates/chain/tests/partition_assignments/mod.rs
  • crates/chain/tests/programmable_data/mod.rs
  • crates/chain/tests/promotion/mod.rs
  • crates/chain/tests/startup/mod.rs
💤 Files with no reviewable changes (11)
  • crates/chain/tests/data_sync/mod.rs
  • crates/chain/tests/packing/mod.rs
  • crates/chain/tests/integration/mod.rs
  • crates/chain/tests/multi_node/mod.rs
  • crates/chain/Cargo.toml
  • crates/chain/tests/partition_assignments/mod.rs
  • crates/chain/tests/startup/mod.rs
  • crates/chain/tests/block_production/mod.rs
  • crates/chain/tests/mod.rs
  • crates/chain/tests/promotion/mod.rs
  • crates/chain/tests/programmable_data/mod.rs

Comment thread crates/chain-tests/src/packing/remote_packing.rs

@roberts-pumpurs roberts-pumpurs left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@xtask/src/main.rs`:
- Line 385: The Clippy invocation under the LocalChecks path currently calls
run_command(Commands::Clippy { args: vec![] }, sh) without the required flags;
update the args passed to Commands::Clippy so the command includes
"--workspace", "--tests", and "--all-targets" (e.g., populate the args vector
with these strings) so run_command executes "cargo clippy --workspace --tests
--all-targets"; modify the construction of Commands::Clippy in the LocalChecks
branch to include those flags.

ℹ️ Review info

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 95ae3ac and cd545a6.

📒 Files selected for processing (1)
  • xtask/src/main.rs

Comment thread xtask/src/main.rs
},
sh,
)?;
run_command(Commands::Clippy { args: vec![] }, sh)?;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

LocalChecks should include --all-targets in Clippy invocation.

On Line 385, LocalChecks runs clippy without adding --all-targets, so this path does not fully enforce the required pre-PR lint gate.

Proposed fix
-                run_command(Commands::Clippy { args: vec![] }, sh)?;
+                run_command(
+                    Commands::Clippy {
+                        args: vec!["--all-targets".to_string()],
+                    },
+                    sh,
+                )?;

As per coding guidelines: "Run cargo clippy --workspace --tests --all-targets before pushing or creating PRs".

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
run_command(Commands::Clippy { args: vec![] }, sh)?;
run_command(
Commands::Clippy {
args: vec!["--all-targets".to_string()],
},
sh,
)?;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@xtask/src/main.rs` at line 385, The Clippy invocation under the LocalChecks
path currently calls run_command(Commands::Clippy { args: vec![] }, sh) without
the required flags; update the args passed to Commands::Clippy so the command
includes "--workspace", "--tests", and "--all-targets" (e.g., populate the args
vector with these strings) so run_command executes "cargo clippy --workspace
--tests --all-targets"; modify the construction of Commands::Clippy in the
LocalChecks branch to include those flags.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
xtask/src/main.rs (1)

324-331: ⚠️ Potential issue | 🟠 Major

Add --all-targets to clippy in both LocalChecks paths.

Line 330 (clippy --fix) and Line 385 (LocalChecks clippy call) currently do not enforce --all-targets. With --fix, the later verification block is skipped, so this can miss lint failures outside tests.

Proposed fix
                 cmd!(
                     sh,
-                    "cargo clippy --fix --allow-dirty --allow-staged --workspace --tests {args...}"
+                    "cargo clippy --fix --allow-dirty --allow-staged --workspace --tests --all-targets {args...}"
                 )
                 .remove_and_run()?;
@@
-                run_command(Commands::Clippy { args: vec![] }, sh)?;
+                run_command(
+                    Commands::Clippy {
+                        args: vec!["--all-targets".to_string()],
+                    },
+                    sh,
+                )?;

As per coding guidelines: "Run cargo clippy --workspace --tests --all-targets before pushing or creating PRs".

Also applies to: 373-385

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@xtask/src/main.rs` around lines 324 - 331, Update the two clippy invocations
to include the --all-targets flag: modify the cmd! call that currently runs
"cargo clippy --fix --allow-dirty --allow-staged --workspace --tests {args...}"
(inside the RUSTFLAGS guard) and the other clippy invocation in LocalChecks (the
second cmd! that runs clippy between lines ~373-385) to add "--all-targets" so
they become "cargo clippy ... --workspace --tests --all-targets ..."; ensure you
update both places where the clippy command string is built so clippy runs
against all targets.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@xtask/src/main.rs`:
- Around line 324-331: Update the two clippy invocations to include the
--all-targets flag: modify the cmd! call that currently runs "cargo clippy --fix
--allow-dirty --allow-staged --workspace --tests {args...}" (inside the
RUSTFLAGS guard) and the other clippy invocation in LocalChecks (the second cmd!
that runs clippy between lines ~373-385) to add "--all-targets" so they become
"cargo clippy ... --workspace --tests --all-targets ..."; ensure you update both
places where the clippy command string is built so clippy runs against all
targets.

ℹ️ Review info

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cd545a6 and 195d248.

📒 Files selected for processing (1)
  • xtask/src/main.rs

@JesseTheRobot JesseTheRobot merged commit 4bd4bcb into master Mar 4, 2026
18 checks passed
@JesseTheRobot JesseTheRobot deleted the feat/chain-tests-crate branch March 4, 2026 08:07
roberts-pumpurs added a commit that referenced this pull request Mar 9, 2026
Resolve conflicts from master's node startup simplification (#1169),
test migration (#1174), and other refactors while preserving all PD
(programmable data) features.

Key resolutions:
- Port PD chunk channels and services into master's new node_lifecycle()
  async architecture (replaces old init_services_thread + init_reth_thread)
- Keep HEAD's modular packing_service sub-module structure, apply master's
  heavy4_ test rename
- Merge test files into crates/chain-tests with PD modules and master's
  visibility/naming changes
- Move alloy-consensus/network/signer-local to chain-tests deps (used by
  utils.rs lib code)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants