s3vectors test: skip a query lease tag released between list and HEAD (#12409)

A query's lease tag is deleted by a background task after the query
answers, so the encryption helper could list it and then get a 404 on
HEAD. Skip only that case; any other missing object still fails.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Chris LuandClaude Opus 5.5 authored and GitHub committed 2026-11-05 02:01:18 -08:00
1 parent 48df16ea0d
commit b74111ea2f
1 file changed
+10 -1
+10 -1
View File
@@ -304,7 +304,16 @@ def index_object_encryption(vectors, bucket):
keys = [o["Key"] for page in s3.get_paginator("list_objects_v2").paginate(Bucket=bucket, Prefix=f"vector/{INDEX}/")
for o in page.get("Contents", []) if o["Size"] > 0]
assert any("/data/" in key for key in keys) and any("/_versions/" in key for key in keys)
return {key: s3.head_object(Bucket=bucket, Key=key).get("ServerSideEncryption") for key in keys}
encryption = {}
for key in keys:
try:
encryption[key] = s3.head_object(Bucket=bucket, Key=key).get("ServerSideEncryption")
except ClientError as exc:
# a query's lease tag is released in the background after it answers
if "/_refs/tags/weed-vector-query-" in key and exc.response["Error"]["Code"] in ("404", "NoSuchKey"):
continue
raise
return encryption
def test_vector_bucket_encryption(vectors):