@@ -290,7 +290,10 @@ async def test_adds_with_scope_and_writes_a_sidecar(
290290 wait_for_indexed (kb_clients ["agent" ], kb_id , ds_id , {"dataSourceType" : "S3" , "s3" : {"uri" : result .document_id }})
291291
292292 entries = await store .search (marker , SearchOptions (max_search_results = 10 ))
293- assert any (marker in entry .content for entry in entries )
293+ match = next ((entry for entry in entries if marker in entry .content ), None )
294+ assert match is not None
295+ assert match .metadata is not None
296+ assert match .metadata .get ("namespace" ) == scope
294297
295298 async def test_scope_isolates_s3_documents_from_other_scopes (
296299 self , skip_if_no_kb , bedrock_kb_context , kb_clients , cleanup_registrar
@@ -350,7 +353,7 @@ async def test_scope_isolates_s3_documents_from_other_scopes(
350353 async def test_adds_with_metadata_in_the_sidecar (
351354 self , skip_if_no_kb , bedrock_kb_context , kb_clients , cleanup_registrar
352355 ):
353- """Caller metadata supplied to an S3 ``add`` is persisted via the sidecar, and the content stays searchable ."""
356+ """Caller metadata supplied to an S3 ``add`` round-trips through search via the sidecar."""
354357 kb_id = bedrock_kb_context .knowledge_base_id
355358 ds_id = bedrock_kb_context .s3_data_source_id
356359 bucket = bedrock_kb_context .s3_bucket
@@ -378,7 +381,11 @@ async def test_adds_with_metadata_in_the_sidecar(
378381 wait_for_indexed (kb_clients ["agent" ], kb_id , ds_id , {"dataSourceType" : "S3" , "s3" : {"uri" : result .document_id }})
379382
380383 entries = await store .search (marker , SearchOptions (max_search_results = 10 ))
381- assert any (marker in entry .content for entry in entries )
384+ match = next ((entry for entry in entries if marker in entry .content ), None )
385+ assert match is not None
386+ assert match .metadata is not None
387+ assert match .metadata .get ("category" ) == "testing"
388+ assert match .metadata .get ("count" ) == 7
382389
383390
384391# --------------------------------------------------------------------------- #
0 commit comments