Example #1
0
def started_standalone_bootstrap_node(command_line_options_fixture,
                                      docker_client_fixture):
    with conftest.testing_context(command_line_options_fixture,
                                  docker_client_fixture) as context:
        with docker_network_with_started_bootstrap(
                context=context) as bootstrap_node:
            yield bootstrap_node
Example #2
0
def test_heterogenous_validators(command_line_options_fixture,
                                 docker_client_fixture):
    BONDED_VALIDATOR_BLOCKS = 10
    JOINING_VALIDATOR_BLOCKS = 10
    with conftest.testing_context(command_line_options_fixture,
                                  docker_client_fixture,
                                  bootstrap_keypair=BOOTSTRAP_NODE_KEYS,
                                  peers_keypairs=[BONDED_VALIDATOR_KEYS
                                                  ]) as context:
        with docker_network_with_started_bootstrap(
                context=context) as bootstrap_node:
            with started_bonded_validator(context,
                                          bootstrap_node) as bonded_validator:
                contract_path = '/opt/docker/examples/hello_world_again.rho'
                for _ in range(BONDED_VALIDATOR_BLOCKS):
                    bonded_validator.deploy(contract_path)
                    bonded_validator.propose()

                with started_joining_validator(
                        context, bootstrap_node) as joining_validator:
                    joining_validator.generate_faucet_bonding_deploys(
                        bond_amount=123,
                        private_key=JOINING_VALIDATOR_KEYS.private_key,
                        public_key=JOINING_VALIDATOR_KEYS.public_key,
                    )
                    forward_file = joining_validator.cat_forward_file(
                        public_key=JOINING_VALIDATOR_KEYS.public_key)
                    bond_file = joining_validator.cat_bond_file(
                        public_key=JOINING_VALIDATOR_KEYS.public_key)
                    bonded_validator.deploy_string(forward_file)
                    bonded_validator.propose()
                    bonded_validator.deploy_string(bond_file)
                    bonded_validator.propose()
                    for _ in range(JOINING_VALIDATOR_BLOCKS):
                        joining_validator.deploy(contract_path)
                        joining_validator.propose()

                    with started_readonly_peer(
                            context, bootstrap_node) as readonly_peer:
                        # Force sync with the network
                        joining_validator.deploy(contract_path)
                        joining_validator.propose()
                        expected_blocks_count = BONDED_VALIDATOR_BLOCKS + JOINING_VALIDATOR_BLOCKS
                        max_retrieved_blocks = 30
                        wait_for_blocks_count_at_least(
                            readonly_peer,
                            expected_blocks_count,
                            max_retrieved_blocks,
                            expected_blocks_count * 10,
                        )
def test_metrics_api_socket(command_line_options_fixture, docker_client_fixture):
    with conftest.testing_context(command_line_options_fixture, docker_client_fixture) as context:
        with complete_network(context) as network:
            for node in network.nodes:
                exit_code, _ = node.get_metrics()
                assert exit_code == 0, "Could not get the metrics for node {node.name}"
def test_convergence(command_line_options_fixture, docker_client_fixture):
    with conftest.testing_context(command_line_options_fixture, docker_client_fixture) as context:
        with complete_network(context) as network:
            pass
def test_casper_propose_and_deploy(command_line_options_fixture, docker_client_fixture):
    with conftest.testing_context(command_line_options_fixture, docker_client_fixture) as context:
        with complete_network(context) as network:
            casper_propose_and_deploy(context, network)