smite-scenarios: add executor test fixture - #229
Open
morehouse wants to merge 6 commits into
Open
Conversation
Fixture wraps the executor and its mocked peer connection and mocked bitcoind, eliminating lots of boilerplate and simplifying tests. By default the Fixture is also funded with sample_utxo so that tests don't need to manually configure it as a wallet input.
Adds additional Fixture methods so that tests that receive messages or set/get negotiations can use Fixture: - queue: queues messages on the mock connection for the executor to receive - run_err: runs the program expecting an error - with_negotiation: adds an entry to the executor's negotiation map - negotiation: gets an entry from the executor's negotiation map
Adds additional Fixture methods so that tests for the funding/channel_ready flows can use Fixture: - with_utxos: sets custom UTXOs for the bitcoind wallet - queued_len: gets the number of queued and unreceived peer messages - channel_state: gets a channel state from the executor's map - channel_states: gets the executor's entire channel state map - private_mempool: gets the executor's privat mempool
Name and move constant definitions to harness.rs.
MockConnection is no longer used outside harness.rs and can become private, as can several MockBitcoinCli fields and sample_change_spk.
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.
The test fixture eliminates lots of boilerplate code and makes it easier to read and understand what each test is doing.
Additionally, all the hex-string magic constants are given names and moved to
harness.rsto further improve readability.