Skip to content

Commit 2f22d3f

Browse files
committed
test(data_plane): poll for eventual consistency in namespace describe-after-create tests
Backend returns 200 for create_namespace but the namespace may not be immediately visible to describe_namespace on all replicas. Both test_create_namespace_with_schema_rest (sync) and test_namespace_crud_lifecycle_rest_async (async) called describe_namespace immediately after create, hitting the consistency window and getting 404. Replaced direct describe_namespace calls with poll_until / async_poll_until (60s timeout) — the same pattern already used by adjacent tests for record_count updates after upsert. Fixes CI-0041.
1 parent 116e45b commit 2f22d3f

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

tests/integration/test_data_plane.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1599,7 +1599,13 @@ def test_create_namespace_with_schema_rest(client: Pinecone, shared_index_dim2:
15991599
assert created.record_count == 0 # new namespace has no vectors
16001600

16011601
# describe_namespace returns the namespace as accessible (schema was accepted)
1602-
described = index.describe_namespace(name=ns_name)
1602+
# Poll for eventual consistency — backend may not expose the namespace immediately after create
1603+
described = poll_until(
1604+
query_fn=lambda: index.describe_namespace(name=ns_name),
1605+
check_fn=lambda r: isinstance(r, NamespaceDescription),
1606+
timeout=60,
1607+
description=f"namespace {ns_name} visible after create",
1608+
)
16031609
assert isinstance(described, NamespaceDescription)
16041610
assert described.name == ns_name
16051611
assert isinstance(described.record_count, int)

tests/integration/test_data_plane_async.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,8 +596,13 @@ async def test_namespace_crud_lifecycle_rest_async(
596596
assert created.name == ns_name
597597
assert created.record_count == 0 # unified-ns-0002
598598

599-
# 2. Describe namespace — returns NamespaceDescription
600-
described = await idx.describe_namespace(name=ns_name)
599+
# 2. Describe namespace — poll for eventual consistency after create
600+
described = await async_poll_until(
601+
query_fn=lambda: idx.describe_namespace(name=ns_name),
602+
check_fn=lambda r: isinstance(r, NamespaceDescription),
603+
timeout=60,
604+
description=f"namespace {ns_name} visible after create",
605+
)
601606
assert isinstance(described, NamespaceDescription)
602607
assert described.name == ns_name
603608
assert isinstance(described.record_count, int)

0 commit comments

Comments
 (0)