Skip to content

test(node): cover parse_max_batch_entries invalid inputs#156

Open
Kewe63 wants to merge 1 commit into
circlefin:mainfrom
Kewe63:test/max-batch-entries-invalid-input
Open

test(node): cover parse_max_batch_entries invalid inputs#156
Kewe63 wants to merge 1 commit into
circlefin:mainfrom
Kewe63:test/max-batch-entries-invalid-input

Conversation

@Kewe63

@Kewe63 Kewe63 commented Jun 15, 2026

Copy link
Copy Markdown

Overview

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, and empty) are currently not pinned. Because of this, clap surfaces the parser's format!("invalid number: {s}") message verbatim to the operator. Any wording change in these paths would leak out to --help output and CI logs without any test catching the regression.

Changes

  • Added dedicated test cases for each of the four pre-parse failure branches (non-numeric, negative, overflow, empty).
  • Introduced a small err_str helper 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 -> OK
  • cargo fmt --check -p arc-node-execution -> CLEAN

Testing Note

Note

The full cargo test for 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.

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.
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.

1 participant