Skip to content

Conversation

@ValuedMammal
Copy link
Collaborator

@ValuedMammal ValuedMammal commented Jan 30, 2026

Description

This is a follow up to #5 that introduces a TestEnv struct used for integration tests and fixes a number of nitpicks that were previously left out.

Summary:

  • Add simple TestEnv struct with convenient interface for improved ergonomics
  • Avoid manually implementing RPC calls (e.g. generate_to_address)
  • Move auth tests to client::test_auth module
  • Ignore (or remove) test using potentially insecure std::env::tempdir
  • Don't call node.stop(), as this is handled by the Drop implementation of Node
  • Add missing tests for existing RPC methods get_block_verbose, get_block_header_verbose
  • Don't print to stdout
  • Have more effective test assertions. For example it's sufficient to check that the RPC method returns the expected type. Keep some basic "sanity check" assertions, but try to avoid testing functionality that is defined outside of this library (e.g. the length of a BlockHash, and Bitcoin Core itself).

Checklists

All Submissions:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo fmt and cargo clippy before committing

@ValuedMammal ValuedMammal self-assigned this Jan 30, 2026
@ValuedMammal ValuedMammal added the test Tests label Jan 30, 2026
@oleonardolima oleonardolima self-requested a review January 31, 2026 02:12
@oleonardolima
Copy link
Collaborator

oleonardolima commented Jan 31, 2026

Thanks, it's a good idea to have some sort of TestEnv for better organization and ergonomics. An initial cACK for this one, will do a final review and ACK once it's in ready to review state.

@ValuedMammal ValuedMammal force-pushed the test/refactor_testenv branch from 12cea4c to 230c07e Compare February 4, 2026 03:11
In error types that wrap an underlying error, the underlying error
should either be returned by the outer error's source, or rendered
by the outer error's Display implementation, but not both.

ref: <https://doc.rust-lang.org/std/error/trait.Error.html#error-source>
- test,deps: Add `anyhow`
- test: Add `testenv` module
@ValuedMammal ValuedMammal marked this pull request as ready for review February 11, 2026 21:59
@ValuedMammal
Copy link
Collaborator Author

self-ACK f1db39a

@ValuedMammal ValuedMammal merged commit bbb7560 into bitcoindevkit:master Feb 11, 2026
9 checks passed
@ValuedMammal ValuedMammal deleted the test/refactor_testenv branch February 11, 2026 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants