Пример #1
0
def test_is_healthy_in_haproxy_missing_backend_entirely(mock_gethostbyname, ):
    mock_gethostbyname.return_value = "192.0.2.1"
    local_port = 42
    backends = [{
        "status": "DOWN",
        "pxname": "service.main",
        "svname": "192.0.2.4:666_otherhostname",
    }]
    assert (paasta_maintenance.is_healthy_in_haproxy(
        local_port=local_port, backends=backends) is False)
Пример #2
0
def test_is_healthy_in_haproxy_unhealthy_path(mock_gethostbyname, ):
    mock_gethostbyname.return_value = "192.0.2.1"
    local_port = 42
    backends = [{
        "status": "DOWN",
        "pxname": "service.main",
        "svname": "192.0.2.1:42_hostname"
    }]
    assert (paasta_maintenance.is_healthy_in_haproxy(
        local_port=local_port, backends=backends) is False)
Пример #3
0
def test_is_healthy_in_haproxy_missing_backend_entirely(
    mock_gethostbyname
):
    mock_gethostbyname.return_value = '192.0.2.1'
    local_port = 42
    backends = [
        {'status': 'DOWN', 'pxname': 'service.main', 'svname': '192.0.2.4:666_otherhostname'}
    ]
    assert paasta_maintenance.is_healthy_in_haproxy(
        local_port=local_port,
        backends=backends,
    ) is False
Пример #4
0
def test_is_healthy_in_haproxy_unhealthy_path(
    mock_gethostbyname
):
    mock_gethostbyname.return_value = '192.0.2.1'
    local_port = 42
    backends = [
        {'status': 'DOWN', 'pxname': 'service.main', 'svname': '192.0.2.1:42_hostname'}
    ]
    assert paasta_maintenance.is_healthy_in_haproxy(
        local_port=local_port,
        backends=backends,
    ) is False