Skip to content

QA-BitVMX: Added tests to cover protocol configuration#83

Closed
andrelo86 wants to merge 4 commits intodevfrom
qa_test_config
Closed

QA-BitVMX: Added tests to cover protocol configuration#83
andrelo86 wants to merge 4 commits intodevfrom
qa_test_config

Conversation

@andrelo86
Copy link
Copy Markdown
Collaborator

@andrelo86 andrelo86 commented Mar 9, 2026

Add config loading test coverage

Introduces config_test.rs with 4 tests covering Config::new():

  1. Load development config — BITVMX_ENV=development parses successfully and validates builder.ecdsa_sighash_type and rpc.network
  2. Default env fallback — unset BITVMX_ENV falls back to development correctly
  3. Unknown env returns error — nonexistent environment returns ConfigError::ConfigFileError
  4. All development fields — exhaustive validation of every readable field in development.json
  • A static Mutex serializes env-var mutation across tests to prevent race conditions in parallel test runs.

  • _guard explanation
    Here guard is held intentionally for its Drop side effect.
    _guard is the established Rust idiom for this exact pattern — its documented in The Rust Reference as suppress the warning for a binding kept alive for its destructor.

Copy link
Copy Markdown
Contributor

@diegomasini diegomasini left a comment

Choose a reason for hiding this comment

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

LGTM!

@jonasmartin
Copy link
Copy Markdown
Contributor

Closing as we replaced the Config with the use of bitvmx_settings: #86

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.

3 participants