test(node): cover parse_max_batch_entries invalid inputs#156
Open
Kewe63 wants to merge 1 commit into
Open
Conversation
The existing `test_arc_rpc_max_batch_entries_zero_rejected` only
exercises the post-parse `n == 0` rejection. The four pre-parse
branches of `parse_max_batch_entries` — non-numeric, negative,
overflow, empty — are not pinned, and clap surfaces the parser's
`format!("invalid number: {s}")` message verbatim to the
operator. Any wording change there would leak out to
`--help` output and CI logs without any test catching it.
Add one test per branch with a small `err_str` helper so the
assert message embeds the actual error string the operator would
see, not just a pass/fail.
Verified locally with `cargo check -p arc-node-execution --tests`
(1.71s). The full `cargo test` build for this binary OOMs
in the local 8 GB sandbox before the test binary can link, so
test execution is deferred to CI.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Overview
The existing
test_arc_rpc_max_batch_entries_zero_rejectedonly exercises the post-parsen == 0rejection.The four pre-parse branches of
parse_max_batch_entries(non-numeric,negative,overflow, andempty) are currently not pinned. Because of this,clapsurfaces the parser'sformat!("invalid number: {s}")message verbatim to the operator. Any wording change in these paths would leak out to--helpoutput and CI logs without any test catching the regression.Changes
non-numeric,negative,overflow,empty).err_strhelper function so the assertion message embeds the actual error string the operator would see, improving debuggability beyond a simple pass/fail.Verification Results
Automated Checks
cargo check -p arc-node-execution --tests-> OKcargo fmt --check -p arc-node-execution-> CLEANTesting Note
Note
The full
cargo testfor this binary OOMs (Out of Memory) in the local 8 GB sandbox before the test binary can link. Full test execution has been deferred to the CI pipeline.