Skip to content

Add unit tests for protocol, generators, runner, and test_case#140

Draft
DRMacIver wants to merge 1 commit intomainfrom
tests/unit-tests
Draft

Add unit tests for protocol, generators, runner, and test_case#140
DRMacIver wants to merge 1 commit intomainfrom
tests/unit-tests

Conversation

@DRMacIver
Copy link
Copy Markdown
Member

Unit tests for internal modules. Depends on #138 (refactoring).

Covers: cbor_utils error paths, protocol packet/channel/connection errors, value deserialization edge cases, fnv1a_hash, antithesis reporting, runner install/backtrace/settings, request error classification.

Apply production code refactoring for testability:
- Extract panic_message to control.rs (shared by runner.rs and stateful.rs)
- Extract filter_backtrace, install_hegel_server, handle_antithesis_reporting in runner.rs
- Extract classify_request_error and RequestErrorKind in test_case.rs
- Replace LazyLock PROTOCOL_DEBUG with protocol_debug() function
- Add ENV_TEST_MUTEX to lib.rs for env var test serialization
- Add lcov.info to .gitignore

Add unit tests to 9 source files:
- cbor_utils.rs: panic paths for map_get/map_insert, wrong-type returns
- protocol/packet.rs: invalid magic, invalid terminator, checksum mismatch
- protocol/channel.rs: closed channel, server exit, disconnect, no result key
- protocol/connection.rs: mark_server_exited, send_packet error paths
- generators/value.rs: null/bytes/map/bignum conversions, error display, option
- generators/compose.rs: fnv1a_hash determinism, different inputs, empty
- antithesis.rs: env var presence/absence, nonexistent dir, emit_assertion
- runner.rs: Settings, filter_backtrace, panic_message, install_hegel_server
- test_case.rs: classify_request_error, protocol_debug, StopTestError display

Co-Authored-By: Claude Opus 4.6 (1M context) <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.

1 participant