refactor(metering): Use test-utils's TestHarness and move tests inline #346
+978
−1,082
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.
Summary
base-reth-test-utilsbase-bundlespattern with#[cfg(test)]modulesMeteringTestContextfor unit tests andmetering_launcherfor RPC module injectiontests/directory - all 18 tests now run as unit testsSupersedes #338.
Changes
Test Infrastructure:
signer_b256()method toAccountin test-utils for transaction signingMeteringTestContext- bundles provider, header, and chain_spec for metering function testsmetering_launcher- node launcher that injects the metering RPC moduleTest Organization (base-bundles pattern):
#[cfg(any(test, feature = "test-utils"))]fortest_utilsmodule[features](optional) and[dev-dependencies]#[cfg(test)]modulestests/directory entirelyFiles:
src/meter.rs- 3 tests formeter_bundle()src/block.rs- 6 tests formeter_block()src/rpc.rs- 9 tests for RPC endpointsTest plan
cargo test -p base-reth-meteringcargo test -p base-reth-metering --libcargo check -p base-reth-metering --features test-utils