Skip to content

Fix full text policy test assertions to accommodate backend V2 read behavior#45688

Open
aayush3011 wants to merge 4 commits intoAzure:mainfrom
aayush3011:users/akataria/FTSTestFixes
Open

Fix full text policy test assertions to accommodate backend V2 read behavior#45688
aayush3011 wants to merge 4 commits intoAzure:mainfrom
aayush3011:users/akataria/FTSTestFixes

Conversation

@aayush3011
Copy link
Member

Description

The full text policy tests were failing due to a backend change in how the full text policy is returned on reads. The backend now implements V2 of the full text policy while still accepting V1 for backward compatibility. However, the policy returned in the read response is no longer identical to what was sent during container creation.

The backend's updated read behavior now populates both defaultLanguage and defaultSpec fields:

  1. If both defaultLanguage and defaultSpec are set: returned as-is.
  2. If both defaultLanguage and defaultSpec are missing: returned as-is.
  3. If defaultLanguage is missing but defaultSpec is present: defaultLanguage is set to defaultSpec.language.
  4. If defaultLanguage is present but defaultSpec is missing: defaultSpec.language is set to defaultLanguage.

Because the response may contain additional fields not present in the original request, tests now assert on individual fields (defaultLanguage, fullTextPaths) rather than comparing the entire policy object.

Full support for the V2 full text policy with defaultSpec will follow in a separate PR, as the backend is still finalizing additional V2 functionality.

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.

@aayush3011 aayush3011 requested a review from a team as a code owner March 13, 2026 18:35
Copilot AI review requested due to automatic review settings March 13, 2026 18:35
Copy link
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 updates full text policy test assertions in the Cosmos SDK to accommodate a backend V2 change in how full text policies are returned on reads. Instead of comparing the entire policy object (which now may contain additional fields like defaultSpec), tests now assert on individual known fields (defaultLanguage, fullTextPaths).

Changes:

  • Updated assertions in sync and async full text policy tests to compare individual fields rather than entire policy objects.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
sdk/cosmos/azure-cosmos/tests/test_full_text_policy.py Updated sync test assertions to check defaultLanguage and fullTextPaths individually
sdk/cosmos/azure-cosmos/tests/test_full_text_policy_async.py Updated async test assertions to check defaultLanguage and fullTextPaths individually

You can also share your feedback on Copilot code review. Take the survey.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@simorenoh
Copy link
Member

/azp run python - cosmos - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants