Skip to content

[Search] Add 2026-04-01 GA test coverage and recordings#46684

Merged
hizixin merged 2 commits intomainfrom
search/2026-04-01-ga-tests
May 5, 2026
Merged

[Search] Add 2026-04-01 GA test coverage and recordings#46684
hizixin merged 2 commits intomainfrom
search/2026-04-01-ga-tests

Conversation

@hizixin
Copy link
Copy Markdown
Member

@hizixin hizixin commented May 3, 2026

Description

This PR updates the azure-search-documents test suite for the 2026-04-01 GA release and refreshes the playback recordings.

The main goal is to reorganize and strengthen Search test coverage without losing coverage from the previous suite. Tests are now grouped by public client and resource area, with SDK owned behavior covered by unit tests and service contract behavior covered by live tests.

TypeSpec source: Azure/azure-rest-api-specs@d62196d5e224f0cd58f6dd2dbd082ed72300af5a

Related issues: N/A

Coverage proof

This PR was audited against the previous main branch test suite.

Coverage check Result
Previous main branch pytest tests reviewed 95
Previous tests mapped to equivalent or stronger current coverage 95
Known coverage gaps from the rewrite 0

Every previous main branch test is accounted for by an equivalent or stronger current test. Some coverage moved from live tests to unit tests where the behavior is SDK owned and does not require the Azure Search service. The new layout keeps service contract behavior in live tests and SDK behavior in faster, deterministic unit tests.

File mapping

Many files show as removed because the suite was reorganized by public client and resource area. The coverage is preserved in the new files below.

Previous file or area Current file or area
test_buffered_sender.py, test_buffered_sender_async.py test_search_indexing_buffered_sender.py, test_search_indexing_buffered_sender_async.py
test_search_client_buffered_sender_live.py, test_search_client_buffered_sender_live_async.py test_search_indexing_buffered_sender_live.py, test_search_indexing_buffered_sender_live_async.py
test_search_client_basic_live.py, test_search_client_basic_live_async.py test_search_client_documents_live.py, test_search_client_documents_live_async.py
test_search_client_index_document_live.py, test_search_client_index_document_live_async.py test_search_client_index_documents_live.py, test_search_client_index_documents_live_async.py
test_search_index_client_live.py, test_search_index_client_live_async.py test_search_index_client_indexes_live.py, test_search_index_client_indexes_live_async.py
test_search_index_client_alias_live.py, test_search_index_client_alias_live_async.py test_search_index_client_aliases_live.py, test_search_index_client_aliases_live_async.py
test_search_index_client_synonym_map_live.py, test_search_index_client_synonym_map_live_async.py test_search_index_client_synonym_maps_live.py, test_search_index_client_synonym_maps_live_async.py
test_search_index_client_data_source_live.py, test_search_index_client_data_source_live_async.py test_search_indexer_client_data_sources_live.py, test_search_indexer_client_data_sources_live_async.py
test_search_indexer_client_live.py, test_search_indexer_client_live_async.py test_search_indexer_client_indexers_live.py, test_search_indexer_client_indexers_live_async.py
test_search_index_client_skillset_live.py, test_search_index_client_skillset_live_async.py test_search_indexer_client_skillsets_live.py, test_search_indexer_client_skillsets_live_async.py
test_knowledge_base_configuration_live.py, test_knowledge_base_configuration_live_async.py test_search_index_client_knowledge_base_configurations_live.py, test_search_index_client_knowledge_base_configurations_live_async.py
test_knowledge_base_live.py, test_knowledge_base_live_async.py test_search_index_client_knowledge_bases_live.py, test_search_index_client_knowledge_bases_live_async.py
test_knowledge_source_web_live.py, test_knowledge_source_web_live_async.py test_search_index_client_knowledge_sources_live.py, test_search_index_client_knowledge_sources_live_async.py
KnowledgeBaseRetrievalClient area coverage, new dedicated files with no previous dedicated test file test_knowledge_base_retrieval_client_live.py, test_knowledge_base_retrieval_client_live_async.py
test_index_field_helpers.py test_search_field_helpers.py
test_serialization.py test_search_index_model.py, test_search_indexer_models.py
test_search_index_client_async.py Removed old async utility file, no pytest test functions in the base file
hotel_schema.json, hotel_small.json, hotel_large.json Deterministic hotel fixture builders in _search_helpers.py, used by sync and async live helpers (_search_helpers_async.py)

Test design

Test type Purpose
Unit tests SDK owned behavior that can be proven without HTTP, including request construction, option mapping, pagination behavior, serialization, model helpers, and buffered sender retry logic
Live tests Azure Search service contract behavior that requires the real service, including resource CRUD, accepted request shapes, indexing behavior, and document result semantics
Sync and async tests Kept in parity unless the behavior is intentionally sync only or async only

The suite is intentionally unit first. Live tests are not meant to duplicate SDK owned assertions that unit tests can cover more deterministically. This keeps live tests focused on what only the service can prove, while preserving coverage through faster and more stable unit tests.

Notable changes

Area Change
Test layout Renamed and regrouped tests by public client and resource area
Live helpers Added deterministic resource builders and cleanup helpers
Hotel fixtures Replaced static JSON files with generated deterministic fixtures
SearchClient tests Added stronger unit coverage for request building and option normalization
Buffered sender tests Added focused unit and live coverage for defaults, context managers, batching, callbacks, retry behavior, 413 split behavior, upload replacement, and delete behavior
Alias tests Removed stale etag assumptions that did not hold against the service
Data source tests Kept conditional etag coverage where the service enforces it
Recordings Updated assets.json to python/search/azure-search-documents_575b3d2518

Source fixes included

This PR includes two small async buffered sender fixes found while strengthening tests.

File Fix
azure/search/documents/aio/_operations/_patch.py Fixes async 413 recursive split so the second half passes batch=IndexDocumentsBatch(...), matching the method signature and the first half
azure/search/documents/aio/_patch.py Awaits async retry failure callbacks instead of scheduling them with asyncio.create_task, restoring deterministic callback behavior

The async callback behavior matches the old 11.7.0b2 AutoRest era buffered sender semantics, where retry terminal failures awaited _callback_fail.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 3, 2026 04:32
@hizixin hizixin requested review from a team as code owners May 3, 2026 04:32
@github-actions github-actions Bot added the Search label May 3, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modernizes and expands azure-search-documents test coverage for the 2026-04-01 GA surface by replacing older live-test patterns (schema/batch-file driven) with helper-based resource provisioning and adding new live/unit tests for key client/model behaviors.

Changes:

  • Replaces legacy live tests with new scenario-focused live tests for SearchIndexClient/SearchIndexerClient/SearchClient (sync + async), plus knowledge base/source coverage.
  • Adds/updates unit tests for helper models (e.g., SearchIndex, SearchField*, indexer model serialization) and IndexDocumentsBatch.
  • Updates async buffered sender retry behavior and fixes async indexing request splitting to pass batches correctly; updates assets.json tag and removes obsolete test assets.

Reviewed changes

Copilot reviewed 74 out of 74 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
sdk/search/azure-search-documents/tests/test_serialization.py Removed legacy serialization tests (replaced by targeted unit tests).
sdk/search/azure-search-documents/tests/test_search_index_model.py New unit tests for SearchIndex helper serialization/round-trips.
sdk/search/azure-search-documents/tests/test_search_indexer_models.py New unit tests for indexer model helper serialization.
sdk/search/azure-search-documents/tests/test_search_field_helpers.py New unit tests for SearchField* helper model behavior.
sdk/search/azure-search-documents/tests/test_index_documents_batch.py Expanded unit coverage for IndexDocumentsBatch helpers and semantics.
sdk/search/azure-search-documents/tests/test_search_client_documents_live.py New live tests for document lookup operations (sync).
sdk/search/azure-search-documents/tests/test_search_client_documents_live_async.py New live tests for document lookup operations (async).
sdk/search/azure-search-documents/tests/test_search_client_index_documents_live.py New live tests for document indexing CRUD operations (sync).
sdk/search/azure-search-documents/tests/test_search_client_index_documents_live_async.py New live tests for document indexing CRUD operations (async).
sdk/search/azure-search-documents/tests/test_search_indexing_buffered_sender_live.py New live tests for buffered sender queue/flush behavior (sync).
sdk/search/azure-search-documents/tests/test_search_indexing_buffered_sender_live_async.py New live tests for buffered sender queue/flush behavior (async).
sdk/search/azure-search-documents/tests/test_search_index_client_aliases_live.py New live tests for alias operations (sync).
sdk/search/azure-search-documents/tests/test_search_index_client_aliases_live_async.py New live tests for alias operations (async).
sdk/search/azure-search-documents/tests/test_search_index_client_synonym_maps_live.py New live tests for synonym map operations (sync).
sdk/search/azure-search-documents/tests/test_search_index_client_synonym_maps_live_async.py New live tests for synonym map operations (async).
sdk/search/azure-search-documents/tests/test_search_index_client_indexes_live.py New live tests for index operations (sync).
sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_sources_live.py New live tests for web knowledge source operations (sync).
sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_sources_live_async.py New live tests for web knowledge source operations (async).
sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_bases_live.py New live tests for knowledge base CRUD + source-status polling (sync).
sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_bases_live_async.py New live tests for knowledge base CRUD + source-status polling (async).
sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_base_configurations_live.py New live tests for KB configuration round-trips (sync).
sdk/search/azure-search-documents/tests/test_search_index_client_knowledge_base_configurations_live_async.py New live tests for KB configuration round-trips (async).
sdk/search/azure-search-documents/tests/test_knowledge_base_retrieval_client_live.py New live tests for KnowledgeBaseRetrievalClient.retrieve (sync).
sdk/search/azure-search-documents/tests/test_knowledge_base_retrieval_client_live_async.py New live tests for KnowledgeBaseRetrievalClient.retrieve (async).
sdk/search/azure-search-documents/tests/test_search_indexer_client_skillsets_live.py New live tests for skillset operations (sync).
sdk/search/azure-search-documents/tests/test_search_indexer_client_skillsets_live_async.py New live tests for skillset operations (async).
sdk/search/azure-search-documents/tests/test_search_indexer_client_live.py Removed legacy indexer client live tests.
sdk/search/azure-search-documents/tests/test_search_indexer_client_live_async.py Removed legacy indexer client live tests (async).
sdk/search/azure-search-documents/tests/test_search_index_client_live.py Removed legacy index client live tests.
sdk/search/azure-search-documents/tests/test_search_index_client_async.py Removed old async test utilities (replaced by new structure).
sdk/search/azure-search-documents/tests/test_search_index_client_alias_live.py Removed legacy alias live tests.
sdk/search/azure-search-documents/tests/test_search_index_client_alias_live_async.py Removed legacy alias live tests (async).
sdk/search/azure-search-documents/tests/test_search_index_client_synonym_map_live.py Removed legacy synonym-map live tests.
sdk/search/azure-search-documents/tests/test_search_index_client_synonym_map_live_async.py Removed legacy synonym-map live tests (async).
sdk/search/azure-search-documents/tests/test_search_index_client_skillset_live_async.py Removed legacy skillset live tests (async).
sdk/search/azure-search-documents/tests/test_search_index_client_data_source_live.py Removed legacy data source live tests.
sdk/search/azure-search-documents/tests/test_search_index_client_data_source_live_async.py Removed legacy data source live tests (async).
sdk/search/azure-search-documents/tests/test_search_client_basic_live.py Removed legacy basic SearchClient live tests.
sdk/search/azure-search-documents/tests/test_search_client_basic_live_async.py Removed legacy basic SearchClient live tests (async).
sdk/search/azure-search-documents/tests/test_search_client_index_document_live.py Removed legacy doc indexing live tests (sync).
sdk/search/azure-search-documents/tests/test_search_client_index_document_live_async.py Removed legacy doc indexing live tests (async).
sdk/search/azure-search-documents/tests/test_search_client_buffered_sender_live.py Removed legacy buffered sender live tests (sync).
sdk/search/azure-search-documents/tests/test_search_client_buffered_sender_live_async.py Removed legacy buffered sender live tests (async).
sdk/search/azure-search-documents/tests/test_knowledge_source_web_live.py Removed legacy web knowledge source live tests (sync).
sdk/search/azure-search-documents/tests/test_knowledge_source_web_live_async.py Removed legacy web knowledge source live tests (async).
sdk/search/azure-search-documents/tests/test_knowledge_base_live.py Removed legacy knowledge base live tests (sync).
sdk/search/azure-search-documents/tests/test_knowledge_base_live_async.py Removed legacy knowledge base live tests (async).
sdk/search/azure-search-documents/tests/test_knowledge_base_configuration_live.py Removed legacy KB configuration live tests (sync).
sdk/search/azure-search-documents/tests/test_knowledge_base_configuration_live_async.py Removed legacy KB configuration live tests (async).
sdk/search/azure-search-documents/tests/test_index_field_helpers.py Removed legacy index field helper tests (superseded).
sdk/search/azure-search-documents/tests/test_buffered_sender.py Removed legacy buffered sender unit tests (sync).
sdk/search/azure-search-documents/tests/test_buffered_sender_async.py Removed legacy buffered sender unit tests (async).
sdk/search/azure-search-documents/tests/search_service_preparer.py Simplified live-test preparer/cleanup flow for new test approach.
sdk/search/azure-search-documents/tests/hotel_schema.json Removed schema file no longer used by the new live-test setup.
sdk/search/azure-search-documents/azure/search/documents/aio/_patch.py Makes async buffered sender retry path await callback fail handling.
sdk/search/azure-search-documents/azure/search/documents/aio/_operations/_patch.py Fixes recursive 413-splitting to pass a batch (not actions=).
sdk/search/azure-search-documents/assets.json Updates recordings/tag reference for azure-search-documents.

Comment thread sdk/search/azure-search-documents/tests/search_service_preparer.py
@hizixin hizixin force-pushed the search/2026-04-01-ga-tests branch 2 times, most recently from 7fbd4de to 04cdf97 Compare May 3, 2026 06:27
Comment thread sdk/search/azure-search-documents/tests/test_serialization.py
@hizixin hizixin force-pushed the search/2026-04-01-ga-tests branch from 04cdf97 to 6f4edbc Compare May 5, 2026 02:43
Add targeted unit coverage for SDK-owned Search behavior, including
buffered sender defaults, processing checks, context managers, field
helpers, and SearchClient metadata accessors.

Restore meaningful live coverage for knowledge resource ETags and
buffered sender upload replacement and delete behavior.

Refresh buffered sender recordings and update the asset tag.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@hizixin hizixin force-pushed the search/2026-04-01-ga-tests branch from 6f4edbc to fadc76f Compare May 5, 2026 02:45
@hizixin hizixin requested a review from a team May 5, 2026 03:14
@github-project-automation github-project-automation Bot moved this from Untriaged to In Progress in Azure SDK for Search May 5, 2026
@hizixin hizixin merged commit 8ed1412 into main May 5, 2026
20 checks passed
@hizixin hizixin deleted the search/2026-04-01-ga-tests branch May 5, 2026 18:47
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Azure SDK for Search May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants