Skip to content

PYTHON-6056 Remove redundant cleanup in TestSearchIndexProse test_case_3 - #3027

Open
blink1073 wants to merge 1 commit into
mongodb:mainfrom
blink1073:claude/search-index-failures-ba7404
Open

PYTHON-6056 Remove redundant cleanup in TestSearchIndexProse test_case_3#3027
blink1073 wants to merge 1 commit into
mongodb:mainfrom
blink1073:claude/search-index-failures-ba7404

Conversation

@blink1073

@blink1073 blink1073 commented Aug 31, 2026

Copy link
Copy Markdown
Member

PYTHON-6056

Changes in this PR

PYTHON-6056 (#3012) added addAsyncCleanup(self.drop_and_wait, self.coll0, _NAME) to test_case_3, but that test already drops the index and waits for list_search_indexes to return empty in its own body. The test has failed on every run since #3012 merged (confirmed via Evergreen task history: last pass before the merge, failing on every run after).

  • Removed the redundant addAsyncCleanup/addCleanup call from test_case_3 in both the async source and its generated sync mirror.

Test Plan

Run the search_index test: patch

Checklist

Checklist for Author

  • Did you update the changelog (if necessary)? — not needed, test-only fix
  • Is there test coverage?
  • Is any followup work tracked in a JIRA ticket? If so, add link(s). — not needed, single self-contained fix

Checklist for Reviewer

  • Does the title of the PR reference a JIRA Ticket?
  • Do you fully understand the implementation? (Would you be comfortable explaining how this code works to someone else?)
  • Is all relevant documentation (README or docstring) updated?

test_case_3 already drops the index and waits for it to disappear in
its own body. The addCleanup added by PYTHON-6056 ran drop_search_index
a second time in teardown against an already-deleted index, and the
server's IndexNotFound (code 27) isn't in drop_search_index's
allowable_errors, so it raised and failed the test on every run since
that PR merged.
@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@blink1073
blink1073 marked this pull request as ready for review September 1, 2026 00:15
@blink1073
blink1073 requested a review from a team as a code owner September 1, 2026 00:15
@blink1073
blink1073 requested review from sleepyStick and a lite review from Copilot September 1, 2026 00:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 targets a persistent failure in the Search Index prose test suite by removing a redundant cleanup step in test_case_3, where the test already performs a drop_search_index and waits for list_search_indexes to become empty.

Changes:

  • Removed addCleanup(self.drop_and_wait, ...) from the synchronous test_case_3.
  • Removed addAsyncCleanup(self.drop_and_wait, ...) from the asynchronous test_case_3.

Reviewed changes

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

File Description
test/test_index_management.py Removes the extra synchronous cleanup registration from test_case_3.
test/asynchronous/test_index_management.py Removes the extra async cleanup registration from test_case_3.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 213 to 216
# Create a new search index on ``self.coll0``.
model = {"name": _NAME, "definition": {"mappings": {"dynamic": False}}}
resp = await self.coll0.create_search_index(model)
self.addAsyncCleanup(self.drop_and_wait, self.coll0, _NAME)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants