Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests to account for search indexing happening as a background task #82

Merged
merged 1 commit into from
Jan 20, 2025

Conversation

gasman
Copy link
Collaborator

@gasman gasman commented Jan 20, 2025

As of wagtail/wagtail#12787 in Wagtail 6.4, search indexing ordinarily happens at the end of the transaction where the objects are created/updated. Since tests are wrapped in transactions, we need to explicitly invoke the oncommit callbacks via self.captureOnCommitCallbacks(execute=True) to ensure that the changes we make to the database are reflected in search results.

As of wagtail/wagtail#12787 in Wagtail 6.4, search indexing ordinarily happens at the end of the transaction where the objects are created/updated. Since tests are wrapped in transactions, we need to explicitly invoke the oncommit callbacks via `self.captureOnCommitCallbacks(execute=True)` to ensure that the changes we make to the database are reflected in search results.
@gasman gasman merged commit 7776927 into wagtail:main Jan 20, 2025
6 checks passed
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.

1 participant