Skip to content

Instantly share code, notes, and snippets.

@adaszko
Created December 14, 2018 11:47
Show Gist options
  • Save adaszko/8c47b149518b9ef99e6391e12ee71e48 to your computer and use it in GitHub Desktop.
Save adaszko/8c47b149518b9ef99e6391e12ee71e48 to your computer and use it in GitHub Desktop.
________________________ test_casper_propose_and_deploy ________________________
command_line_options_fixture = CommandLineOptions(node_startup_timeout=1800, network_converge_timeout=1800, receive_timeout=30, command_timeout=1800, mount_dir='/tmp/integration-tests.342.kPHSknfjwI')
docker_client_fixture = <docker.client.DockerClient object at 0x7f7e8d7c6550>
def test_casper_propose_and_deploy(command_line_options_fixture, docker_client_fixture):
"""Deploy a contract and then checks if all the nodes have received the block
containing the contract.
"""
with conftest.testing_context(command_line_options_fixture, docker_client_fixture) as context:
with complete_network(context) as network:
token_size = 20
contract_name = 'contract.rho'
for node in network.nodes:
random_token = random_string(token_size)
expected_string = make_expected_string(node, random_token)
block_hash = deploy_block(node, expected_string, contract_name)
expected_string = make_expected_string(node, random_token)
other_nodes = [n for n in network.nodes if n.container.name != node.container.name]
for node in other_nodes:
> wait_for_block_contains(context, node, block_hash, expected_string)
test/test_network_topology.py:105:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test/wait.py:147: in wait_for_block_contains
wait_on_using_wall_clock_time(predicate, context.receive_timeout)
test/wait.py:121: in wait_on_using_wall_clock_time
is_satisfied = predicate.is_satisfied()
test/wait.py:96: in is_satisfied
block = self.node.get_block(self.block_hash)
test/rnode.py:152: in get_block
return self.rnode_command('show-block', block_hash, stderr=False)
test/rnode.py:190: in rnode_command
return self.shell_out(rnode_binary, *node_args, stderr=stderr)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Node(name='rchain-qdfac.peer0')>, stderr = False
cmd = ('/opt/docker/bin/rnode', 'show-block', 'c73899ef3e'), exit_code = 1
output = 'Error: Failure to find block with hash c73899ef3e\n'
def shell_out(self, *cmd: str, stderr=True) -> str:
exit_code, output = self._exec_run_with_timeout(cmd, stderr=stderr)
if exit_code != 0:
> raise NonZeroExitCodeError(command=cmd, exit_code=exit_code, output=output)
E test.common.NonZeroExitCodeError
test/rnode.py:186: NonZeroExitCodeError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment