Пример #1
0
def test_replication_status_with_node_down(environment,
                                           physical_replication_node):
    test_utils.deactivate_node(environment.master_node)
    time.sleep(5)
    assert physical_replication_node.replication_status == 'stopped'
    assert physical_replication_node.is_replication_stopped()
    assert not physical_replication_node.is_replication_running()
Пример #2
0
def test_server_none_with_node_down(environment, physical_replication_node):
    test_utils.deactivate_node(environment.replication_node)

    assert physical_replication_node.mode == '-'
    assert physical_replication_node.replication_status == '-'
    assert physical_replication_node.seconds_behind == '-'
    assert not physical_replication_node.master
    assert not physical_replication_node.server_id
    assert not physical_replication_node.master_server_id
Пример #3
0
def test_cannot_start_with_master_node_down(environment, default_connection):
    node_write = inner_logic.get_node(
        environment.group, environment.master, default_connection
    )
    assert node_write.is_mysql_status_up()

    test_utils.deactivate_node(environment.master_node)
    assert node_write.is_mysql_status_down()
    with pytest.raises(NodeIsDownError):
        inner_logic.start(environment.group, default_connection)

    test_utils.activate_node(environment.master_node)
Пример #4
0
def test_cannot_failover_node_down(environment, default_connection, capsys):
    test_utils.deactivate_node(environment.replication_node)

    try:
        inner_logic.failover(environment.group, default_connection)
        assert False
    except NodeIsDownError:
        assert True
    except:
        assert False
    finally:
        test_utils.activate_node(environment.replication_node)
        test_utils.wait_for_replication_ok(environment, capsys)
Пример #5
0
def test_cannot_start_with_master_node_down(environment, capsys,
                                            default_connection,
                                            default_logger):
    node_write = formatter.check_write(environment.group, default_connection,
                                       default_logger)
    assert node_write.is_mysql_status_up()

    test_utils.deactivate_node(environment.master_node)
    assert node_write.is_mysql_status_down()

    formatter.start(environment.group, default_connection, default_logger)
    out, err = capsys.readouterr()
    assert 'Connection could not established with write node' in out

    test_utils.activate_node(environment.master_node)
Пример #6
0
def shut_down_master_node(environment):
    code, out, err = test_utils.deactivate_node(environment.master_node)
    assert code == 0
Пример #7
0
def test_node_master_with_master_down(environment, physical_replication_node):
    test_utils.deactivate_node(environment.master_node)
    time.sleep(5)
    assert physical_replication_node.master
Пример #8
0
def test_mysql_status_down(environment, physical_master_node):
    test_utils.deactivate_node(environment.master_node)
    assert physical_master_node.mysql_status == 'Down'
    assert not physical_master_node.is_mysql_status_up()
    assert physical_master_node.is_mysql_status_down()
Пример #9
0
def test_heartbeat_with_delay(environment, physical_replication_node):
    test_utils.deactivate_node(environment.master_node)
    time.sleep(5)
    assert physical_replication_node.seconds_behind > 0