Files
scylladb/test/rest_api/test_failure_detector.py
Avi Kivity f3eade2f62 treewide: relicense to ScyllaDB-Source-Available-1.0
Drop the AGPL license in favor of a source-available license.
See the blog post [1] for details.

[1] https://www.scylladb.com/2024/12/18/why-were-moving-to-a-source-available-license/
2024-12-18 17:45:13 +02:00

30 lines
1.1 KiB
Python

# Copyright 2023-present ScyllaDB
#
# SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
import re
import time
def test_failure_detector_endpoints(rest_api):
resp = rest_api.send('GET', "failure_detector/endpoints")
resp.raise_for_status()
assert len(resp.json()) == 1
addr = resp.json()[0]['addrs']
assert re.match(r'\d+\.\d+\.\d+\.\d+', addr)
def test_failure_detector_endpoint_phi_values(rest_api):
# This api currently always returns empty results
# so just check it doesn't return an error or crash
resp = rest_api.send('GET', "failure_detector/endpoint_phi_values")
resp.raise_for_status()
def test_nonzero_generation(rest_api):
# In older versions of Scylla, shards other than 0 would return generation=0.
# Call the endpoint multiple times to increase the chance of hitting nonzero shard.
for _ in range(100):
resp = rest_api.send('GET', "failure_detector/endpoints")
resp.raise_for_status()
assert len(resp.json()) == 1
gen = int(resp.json()[0]['generation'])
assert gen > 0