Skip to content

Instantly share code, notes, and snippets.

@Blazing-Mike
Created August 12, 2022 21:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Blazing-Mike/e1d1e1940a6fb5cc0a9590d304344d37 to your computer and use it in GitHub Desktop.
Save Blazing-Mike/e1d1e1940a6fb5cc0a9590d304344d37 to your computer and use it in GitHub Desktop.
def setup_network(self):
"""Setup the test network topology"""
def run_test(self):
"""Main test logic"""
self.log.info("Starting test!")
"""Let the user know the test has started"""
self.sync_all(self.nodes)
"""Sync all nodes for the test (1,2)"""
self.nodes[1].generate(1)
"""Generating 1 block from node 1"""
self.log.info("Wait for node 2 to receive all the blocks from node 1")
self.sync_blocks()
"""Sync nodes"""
## what results in terminal looks like when test/functional/example_test.py is run
2022-03-18T10:00:17.559000Z TestFramework (INFO): Initializing test directory /var/folders/vs/dgzyrhqn42503dklng_3q34w0000gn/T/bitcoin_func_test_usvhza8a
2022-07-18T10:00:21.187000Z TestFramework (INFO): Starting test!
2022-07-18T10:00:21.187000Z TestFramework (INFO): Calling a custom function
2022-07-18T10:00:21.188000Z TestFramework (INFO): Calling a custom method
2022-07-18T10:00:21.188000Z TestFramework (INFO): Running custom_method
2022-07-18T10:00:21.188000Z TestFramework (INFO): Create some blocks
2022-07-18T10:00:21.203000Z TestFramework (INFO): Wait for node1 to reach current tip (height 11) using RPC
2022-07-18T10:00:21.225000Z TestFramework (INFO): Connect node2 and node1
2022-07-18T10:00:21.290000Z TestFramework (INFO): Wait for node2 to receive all the blocks from node1
2022-07-18T10:00:22.311000Z TestFramework (INFO): Add P2P connection to node2
2022-07-18T10:00:22.485000Z TestFramework (INFO): Test that node2 propagates all the blocks to us
2022-07-18T10:00:22.536000Z TestFramework (INFO): Check that each block was received only once
2022-07-18T10:00:22.592000Z TestFramework (INFO): Stopping nodes
2022-07-18T10:00:23.187000Z TestFramework (INFO): Cleaning up /var/folders/vs/dgzyrhqn42503dklng_3q34w0000gn/T/bitcoin_func_test_usvhza8a on exit
2022-07-18T10:00:23.187000Z TestFramework (INFO): Tests successful
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment