Files
scylladb/test/rest_api/test_gossiper.py
Nadav Har'El 8c215141a1 test: rename "cql-pytest" to "cqlpy"
Python and Python developers don't like directory names to include a
minus sign, like "cql-pytest". In this patch we rename test/cql-pytest
to test/cqlpy, and also change a few references in other code (e.g., code
that used test/cql-pytest/run.py) and also references to this test suite
in documentation and comments.

Arguably, the word "test" was always redundant in test/cql-pytest, and
I want to leave the "py" in test/cqlpy to emphasize that it's Python-based
tests, contrasting with test/cql which are CQL-request-only approval
tests.

Fixes #20846

Signed-off-by: Nadav Har'El <nyh@scylladb.com>
2024-11-06 16:48:36 +02:00

43 lines
1.4 KiB
Python

# Copyright 2023-present ScyllaDB
#
# SPDX-License-Identifier: AGPL-3.0-or-later
import pytest
import sys
import requests
import threading
import time
# Use the util.py library from ../cqlpy:
sys.path.insert(1, sys.path[0] + '/test/cqlpy')
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())
assert not unreachable_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