FakeBitcoinProxy: a mock RPC implementation.#136
Merged
Conversation
Use FakeBitcoinProxy as an alternative to mocking bitcoin.rpc.Proxy in unit tests by downstream applications. FakeBitcoinProxy implements a similar interface and returns values similar to those from the bitcoin.rpc.Proxy API. Downstream applications could use this for unit testing their bitcoin applications, leaving bitcoind "regtest" for integration testing modes instead. Also, unit tests for FakeBitcoinProxy are provided.
Owner
|
Mind adding the standard copyright headers that are in other files in this repo to the new files? |
Contributor
|
@kanzure we want to merge this code into https://github.com/Simplexum/python-bitcointx, but as the files do not have standard copyright headers, it is unclear if this code is OK to add to LGPLv3 library and be covered under this license. It may be implied by the fact that this is a pull request to LGPLv3 lib, but still, this is not explicit. Could you please clarify the license status of this code ? |
Owner
|
License is the same as the rest of the code; I got permission from the owner (LedgerX) to clarify things. |
petertodd
added a commit
that referenced
this pull request
Jan 2, 2019
4b5c0b6 FakeBitcoinProxy: a mock RPC implementation. (Bryan Bishop) Pull request description: FakeBitcoinProxy provides an interface similar to the bitcoin.rpc.Proxy API. Downstream applications interested in unit testing can use FakeBitcoinProxy as an alternative to elaborate Proxy mocks. This interface returns similar values as Proxy and is intended to have similar behavior. Unit tests are provided and they are passing. We've been using FakeBitcoinProxy since 2015 to test many different bitcoin applications, which have also been tested against bitcoin nodes running on regtest, testnet and mainnet. Specifically, we pass in FakeBitcoinProxy instead of a bitcoin connection and we get back the same behavior in these different environments using the same interface. Ideally, this contribution would also include tests to show parity between Proxy and FakeBitcoinProxy, even against active bitcoind nodes, but given extensive usage in multiple environments it seems like less of a priority right now. An interesting future direction for this would be to load test blockchain data from bitcoind regtest files, and then load that up for testing. I have some tools for handcrafting regtest reorg scenarios using FakeBitcoinProxy but I think it would be better to load from file and do less handcrafting. Tree-SHA512: 3d358abb4278903c068619da2b370a06b93438638974c4fa57a658dc76342d44e68ff1f85dc2065de39968ce6a2689e2eb38fef7616e82eba2451ec86f47793b
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.
FakeBitcoinProxy provides an interface similar to the bitcoin.rpc.Proxy API. Downstream applications interested in unit testing can use FakeBitcoinProxy as an alternative to elaborate Proxy mocks. This interface returns similar values as Proxy and is intended to have similar behavior.
Unit tests are provided and they are passing.
We've been using FakeBitcoinProxy since 2015 to test many different bitcoin applications, which have also been tested against bitcoin nodes running on regtest, testnet and mainnet. Specifically, we pass in FakeBitcoinProxy instead of a bitcoin connection and we get back the same behavior in these different environments using the same interface.
Ideally, this contribution would also include tests to show parity between Proxy and FakeBitcoinProxy, even against active bitcoind nodes, but given extensive usage in multiple environments it seems like less of a priority right now.
An interesting future direction for this would be to load test blockchain data from bitcoind regtest files, and then load that up for testing. I have some tools for handcrafting regtest reorg scenarios using FakeBitcoinProxy but I think it would be better to load from file and do less handcrafting.