To fix the problem, we need to remove the first, redundant definition of test_gossiper_unreachable_endpoints (lines 19-24). The second definition (lines 25-40) should be retained as it has more substantial test logic. No other code changes or imports are needed, as the test logic is preserved fully in the retained definition. Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Closes scylladb/scylladb#27632
35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
# Copyright 2023-present ScyllaDB
|
|
#
|
|
# SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
|
|
|
|
import pytest
|
|
import sys
|
|
import requests
|
|
import threading
|
|
import time
|
|
|
|
|
|
def test_gossiper_live_endpoints(cql, rest_api):
|
|
resp = rest_api.send("GET", f"gossiper/endpoint/live")
|
|
resp.raise_for_status()
|
|
live_endpoints = set(resp.json())
|
|
all_hosts_endpoints = set([host.address for host in cql.cluster.metadata.all_hosts()])
|
|
assert live_endpoints == all_hosts_endpoints
|
|
|
|
def test_gossiper_unreachable_endpoints(cql, rest_api):
|
|
resp = rest_api.send("GET", f"gossiper/endpoint/down")
|
|
resp.raise_for_status()
|
|
unreachable_endpoints = set(resp.json())
|
|
for ep in unreachable_endpoints:
|
|
resp = rest_api.send("GET", f"gossiper/downtime/{ep}")
|
|
resp.raise_for_status()
|
|
assert int(resp.json()) > 0
|
|
|
|
resp = rest_api.send("GET", f"gossiper/endpoint/live")
|
|
resp.raise_for_status()
|
|
live_endpoints = set(resp.json())
|
|
for ep in live_endpoints:
|
|
resp = rest_api.send("GET", f"gossiper/downtime/{ep}")
|
|
resp.raise_for_status()
|
|
assert int(resp.json()) == 0
|