Skip to content

smite-scenarios: add executor test fixture - #229

Open
morehouse wants to merge 6 commits into
masterfrom
executor_test_fixture
Open

smite-scenarios: add executor test fixture#229
morehouse wants to merge 6 commits into
masterfrom
executor_test_fixture

Conversation

@morehouse

Copy link
Copy Markdown
Collaborator

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.rs to further improve readability.

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