mirror of
https://github.com/qdrant/qdrant.git
synced 2026-09-21 13:37:46 -05:00
test: harden flaky consensus rejoin and JWT snapshot upload checks (#10158)
Tolerate not-yet-ready collection upserts in test_rejoin_cluster and give JWT snapshot uploads more headroom while still bounding auth-rejection hangs.
This commit is contained in:
@@ -753,6 +753,11 @@ def check_rest_access(
|
||||
# https://github.com/psf/requests/issues/5425
|
||||
if should_succeed or not isinstance(e.args[0].args[1], TimeoutError):
|
||||
raise e
|
||||
except requests.exceptions.Timeout:
|
||||
# The same early-response hang can surface as ReadTimeout instead of
|
||||
# ConnectionError(TimeoutError). Tolerate it only for denied requests.
|
||||
if should_succeed:
|
||||
raise
|
||||
|
||||
|
||||
def check_grpc_access(
|
||||
@@ -1395,7 +1400,9 @@ def collection_snapshot():
|
||||
def test_upload_collection_snapshot(collection_snapshot: bytes):
|
||||
check_access(
|
||||
"upload_collection_snapshot",
|
||||
rest_req_kwargs={"files": {"snapshot": collection_snapshot}, "timeout": 1},
|
||||
# Bound hangs on early auth rejection (requests#5425), but leave enough
|
||||
# headroom for authorized uploads under CI load.
|
||||
rest_req_kwargs={"files": {"snapshot": collection_snapshot}, "timeout": 10},
|
||||
path_params={"collection_name": COLL_NAME},
|
||||
)
|
||||
|
||||
@@ -1438,7 +1445,9 @@ def shard_snapshot(shard_snapshot_name):
|
||||
def test_upload_shard_snapshot(shard_snapshot: bytes):
|
||||
check_access(
|
||||
"upload_shard_snapshot",
|
||||
rest_req_kwargs={"files": {"snapshot": shard_snapshot}, "timeout": 1},
|
||||
# Bound hangs on early auth rejection (requests#5425), but leave enough
|
||||
# headroom for authorized uploads under CI load.
|
||||
rest_req_kwargs={"files": {"snapshot": shard_snapshot}, "timeout": 10},
|
||||
path_params={"collection_name": COLL_NAME, "shard_id": SHARD_ID},
|
||||
)
|
||||
|
||||
|
||||
@@ -44,8 +44,8 @@ def test_rejoin_cluster(tmp_path: pathlib.Path, uris_in_env):
|
||||
# fast; under CI load the consensus apply can exceed it even though the operation
|
||||
# eventually commits, so we tolerate an HTTP timeout here.
|
||||
create_collection(peer_api_uris[0], shard_number=N_SHARDS, replication_factor=N_REPLICA, timeout=3, fail_on_error=False)
|
||||
# Collection might not be ready yet, we don't care
|
||||
upsert_random_points(peer_api_uris[0], 100)
|
||||
# Collection might not be ready yet, we don't care — same as the post-recovery loop.
|
||||
upsert_random_points(peer_api_uris[0], 100, fail_on_error=False)
|
||||
print(f"before recovery end {i}")
|
||||
res = requests.get(f"{peer_api_uris[1]}/collections")
|
||||
print(res.json())
|
||||
|
||||
Reference in New Issue
Block a user