Ejemplo n.º 1
0
def get_smartstack_status_human(
    registration, expected_backends_per_location, locations
) -> List[str]:
    if len(locations) == 0:
        return [f"Smartstack: ERROR - {registration} is NOT in smartstack at all!"]

    output = ["Smartstack:"]
    output.append(f"  Haproxy Service Name: {registration}")
    output.append(f"  Backends:")
    for location in locations:
        backend_status = haproxy_backend_report(
            expected_backends_per_location, location.running_backends_count
        )
        output.append(f"    {location.name} - {backend_status}")

        if location.backends:
            backends_table = build_smartstack_backends_table(location.backends)
            output.extend([f"      {line}" for line in backends_table])

    return output
Ejemplo n.º 2
0
def test_haproxy_backend_report_critical():
    normal_count = 10
    actual_count = 1
    status = marathon_serviceinit.haproxy_backend_report(normal_count, actual_count)
    assert "Critical" in status
Ejemplo n.º 3
0
def test_haproxy_backend_report_healthy():
    normal_count = 10
    actual_count = 11
    status = marathon_serviceinit.haproxy_backend_report(normal_count, actual_count)
    assert "Healthy" in status
def test_haproxy_backend_report_critical():
    normal_count = 10
    actual_count = 1
    status = marathon_serviceinit.haproxy_backend_report(
        normal_count, actual_count)
    assert "Critical" in status
def test_haproxy_backend_report_healthy():
    normal_count = 10
    actual_count = 11
    status = marathon_serviceinit.haproxy_backend_report(
        normal_count, actual_count)
    assert "Healthy" in status