Skip to content

Increase timeout window when awaiting tasks#1240

Merged
Strift merged 2 commits into
mainfrom
python-1215-update-test-suite-for-meilisearch-v1460
Jun 9, 2026
Merged

Increase timeout window when awaiting tasks#1240
Strift merged 2 commits into
mainfrom
python-1215-update-test-suite-for-meilisearch-v1460

Conversation

@Strift

@Strift Strift commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Pull Request

Related issue

Fixes #1239

What does this PR do?

  • Increase timeout window when awaiting tasks

PR checklist

Please check if your PR fulfills the following requirements:

  • Did you use any AI tool while implementing this PR (code, tests, docs, etc.)? If yes, disclose it in the PR description and describe what it was used for. AI usage is allowed when it is disclosed.
  • Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
  • Have you read the contributing guidelines?
  • Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!

Summary

Increases the timeout window for awaiting Meilisearch tasks in the test suite to address compatibility with Meilisearch v1.46.0, which has stricter timing requirements.

Changes

Dockerfile

  • Updated base image from python:3.9-buster to python:3.9-slim-trixie
  • Updated uv tooling image from ghcr.io/astral-sh/uv:0.11.16 to ghcr.io/astral-sh/uv:0.11.19
  • Reordered build steps to copy dependency files earlier and set WORKDIR before dependency installation

Test Configuration and Fixtures

  • Added TEST_TASK_TIMEOUT_MS = 30_000 constant in tests/conftest.py and tests/settings/test_settings_facet_search.py
  • Updated _clear_indexes in conftest.py to explicitly pass timeout when waiting for task completion
  • Updated empty_index fixture to wait for index creation tasks with explicit timeout
  • Updated test_composite_embedder_format in tests/settings/test_settings_embedders.py to use 60-second timeout for composite embedder updates
  • Updated facet search settings tests (test_update_facet_search_settings and test_reset_facet_search_settings) to use explicit timeouts when waiting for background tasks

These changes ensure tests reliably complete before timing out when running against Meilisearch v1.46.0.

@Strift Strift added the maintenance Anything related to maintenance (CI, tests, refactoring...) label Jun 9, 2026
@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Docker build environment upgraded to python:3.9-slim-trixie with uv v0.11.19, and test fixtures/methods now enforce explicit task timeouts to support Meilisearch v1.46.0 compatibility.

Changes

Meilisearch v1.46.0 test suite compatibility

Layer / File(s) Summary
Docker build environment upgrade
Dockerfile
Base image upgraded from python:3.9-buster to python:3.9-slim-trixie, uv version bumped to 0.11.19, and build steps reordered to copy pyproject.toml and uv.lock before WORKDIR and dependency sync.
Test fixture timeout standardization
tests/conftest.py
TEST_TASK_TIMEOUT_MS constant defined and applied to _clear_indexes and empty_index fixture to enforce explicit timeouts when waiting for Meilisearch task completion.
Test method timeout updates
tests/settings/test_settings_embedders.py, tests/settings/test_settings_facet_search.py
test_composite_embedder_format updated with explicit 60-second timeout; test_settings_facet_search.py adds TEST_TASK_TIMEOUT_MS constant and applies it to test_update_facet_search_settings and test_reset_facet_search_settings.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

maintenance

Poem

🐰 The timeouts now tick with precision,
As Meilisearch climbs to v1.46's vision,
With Docker refreshed and tests standing tall,
The suite's ready now—compatibility for all! 🎯

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed The PR addresses issue #1239 by implementing increased task timeouts in tests (conftest.py, test_settings_facet_search.py, test_settings_embedders.py) and updating the Dockerfile, making the test suite compatible with Meilisearch v1.46.0.
Out of Scope Changes check ✅ Passed All changes are within scope: Dockerfile upgrade aligns with test infrastructure updates, and test timeout modifications directly address compatibility with Meilisearch v1.46.0 as required by issue #1239.
Title check ✅ Passed The title 'Increase timeout window when awaiting tasks' directly and accurately reflects the main change across all modified files: adding explicit timeouts and timeout constants for Meilisearch task operations.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch python-1215-update-test-suite-for-meilisearch-v1460

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Strift Strift requested a review from curquiza June 9, 2026 05:39

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/conftest.py (1)

77-199: ⚠️ Potential issue | 🟠 Major

Apply explicit timeout_in_ms=TEST_TASK_TIMEOUT_MS to all fixture wait_for_task calls

The v1.46.0 timeout fix is only applied to the autouse cleanup (meilisearch_client.wait_for_task(..., timeout_in_ms=TEST_TASK_TIMEOUT_MS)) and empty_index (client.wait_for_task(..., timeout_in_ms=TEST_TASK_TIMEOUT_MS)). The other fixtures still call wait_for_task without timeout_in_ms, so they can remain flaky:

  • indexes_sample: client.wait_for_task(task.task_uid)
  • index_with_documents: index.wait_for_task(task.task_uid)
  • index_with_documents_and_vectors: index.wait_for_task(settings_update_task.task_uid), index.wait_for_task(document_addition_task.task_uid)
  • index_with_documents_and_facets: index.wait_for_task(task_1.task_uid), index.wait_for_task(task_2.task_uid)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/conftest.py` around lines 77 - 199, Add the explicit
timeout_in_ms=TEST_TASK_TIMEOUT_MS parameter to all wait_for_task calls left
without it: in indexes_sample replace client.wait_for_task(task.task_uid) with
client.wait_for_task(task.task_uid, timeout_in_ms=TEST_TASK_TIMEOUT_MS); in
index_with_documents replace index.wait_for_task(task.task_uid) with
index.wait_for_task(task.task_uid, timeout_in_ms=TEST_TASK_TIMEOUT_MS); in
index_with_documents_and_vectors add timeout_in_ms=TEST_TASK_TIMEOUT_MS to both
index.wait_for_task(settings_update_task.task_uid) and
index.wait_for_task(document_addition_task.task_uid); and in
index_with_documents_and_facets add timeout_in_ms=TEST_TASK_TIMEOUT_MS to
index.wait_for_task(task_1.task_uid) and index.wait_for_task(task_2.task_uid),
ensuring all uses of client.wait_for_task / index.wait_for_task pass
TEST_TASK_TIMEOUT_MS.
🧹 Nitpick comments (2)
tests/settings/test_settings_embedders.py (1)

214-214: ⚡ Quick win

Consider extracting the timeout value into a module-level constant.

The 60-second timeout is now hardcoded in two places (lines 98 and 214). Similar to tests/conftest.py and tests/settings/test_settings_facet_search.py, consider defining a constant for embedder-specific timeouts to improve maintainability.

♻️ Proposed refactor to use a constant
+# Embedder operations (especially model-based ones) can take longer
+TEST_EMBEDDER_TIMEOUT_MS = 60_000
+
+
 def test_get_default_embedders(empty_index):

Then update both usages:

-    index.wait_for_task(response.task_uid, timeout_in_ms=60000)  # embedder config can take longer.
+    index.wait_for_task(response.task_uid, timeout_in_ms=TEST_EMBEDDER_TIMEOUT_MS)

And:

-    update = index.wait_for_task(response.task_uid, timeout_in_ms=60000)
+    update = index.wait_for_task(response.task_uid, timeout_in_ms=TEST_EMBEDDER_TIMEOUT_MS)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/settings/test_settings_embedders.py` at line 214, Extract the hardcoded
60000 timeout into a module-level constant (e.g., EMBEDDER_TASK_TIMEOUT_MS) and
replace both hardcoded occurrences where wait_for_task is called (the calls to
index.wait_for_task(..., timeout_in_ms=60000)) with the constant; ensure the
constant is defined at the top of the test module and used in both places to
improve maintainability and consistency.
tests/settings/test_settings_facet_search.py (1)

4-4: ⚡ Quick win

Avoid duplicating the timeout constant—import from conftest.py.

TEST_TASK_TIMEOUT_MS is already defined in tests/conftest.py with the same value (30,000 ms). Duplicating constants across test files creates maintenance overhead and risks divergence over time.

♻️ Proposed fix to import the constant
+from tests.conftest import TEST_TASK_TIMEOUT_MS
+
 DEFAULT_FACET_SEARCH_SETTINGS_STATUS = True
 ENABLED_FACET_SEARCH_SETTINGS_STATUS = True
 DISABLED_FACET_SEARCH_SETTINGS_STATUS = False
-TEST_TASK_TIMEOUT_MS = 30_000
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/settings/test_settings_facet_search.py` at line 4, Duplicate constant
TEST_TASK_TIMEOUT_MS should be removed from this test and the value imported
from the shared conftest module; delete the local TEST_TASK_TIMEOUT_MS
declaration in tests/settings/test_settings_facet_search.py and add an import
for TEST_TASK_TIMEOUT_MS from the test conftest module (use the conftest export)
and keep existing usages unchanged so the test uses the single shared constant.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Dockerfile`:
- Around line 1-11: The Dockerfile currently runs as root; add a non-root user
and switch to it after installing dependencies: create a user and group (e.g.,
"appuser"), chown the WORKDIR (/home/package) and any files needed by uv, and
add USER appuser before the final image runtime steps; update references around
WORKDIR and the RUN uv sync step so that files are owned by the non-root user
and the container no longer runs as root.

---

Outside diff comments:
In `@tests/conftest.py`:
- Around line 77-199: Add the explicit timeout_in_ms=TEST_TASK_TIMEOUT_MS
parameter to all wait_for_task calls left without it: in indexes_sample replace
client.wait_for_task(task.task_uid) with client.wait_for_task(task.task_uid,
timeout_in_ms=TEST_TASK_TIMEOUT_MS); in index_with_documents replace
index.wait_for_task(task.task_uid) with index.wait_for_task(task.task_uid,
timeout_in_ms=TEST_TASK_TIMEOUT_MS); in index_with_documents_and_vectors add
timeout_in_ms=TEST_TASK_TIMEOUT_MS to both
index.wait_for_task(settings_update_task.task_uid) and
index.wait_for_task(document_addition_task.task_uid); and in
index_with_documents_and_facets add timeout_in_ms=TEST_TASK_TIMEOUT_MS to
index.wait_for_task(task_1.task_uid) and index.wait_for_task(task_2.task_uid),
ensuring all uses of client.wait_for_task / index.wait_for_task pass
TEST_TASK_TIMEOUT_MS.

---

Nitpick comments:
In `@tests/settings/test_settings_embedders.py`:
- Line 214: Extract the hardcoded 60000 timeout into a module-level constant
(e.g., EMBEDDER_TASK_TIMEOUT_MS) and replace both hardcoded occurrences where
wait_for_task is called (the calls to index.wait_for_task(...,
timeout_in_ms=60000)) with the constant; ensure the constant is defined at the
top of the test module and used in both places to improve maintainability and
consistency.

In `@tests/settings/test_settings_facet_search.py`:
- Line 4: Duplicate constant TEST_TASK_TIMEOUT_MS should be removed from this
test and the value imported from the shared conftest module; delete the local
TEST_TASK_TIMEOUT_MS declaration in tests/settings/test_settings_facet_search.py
and add an import for TEST_TASK_TIMEOUT_MS from the test conftest module (use
the conftest export) and keep existing usages unchanged so the test uses the
single shared constant.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 73b25646-38f3-4cd1-a969-2f1be6b57b14

📥 Commits

Reviewing files that changed from the base of the PR and between ada25db and 65c7c9a.

📒 Files selected for processing (4)
  • Dockerfile
  • tests/conftest.py
  • tests/settings/test_settings_embedders.py
  • tests/settings/test_settings_facet_search.py

Comment thread Dockerfile
@Strift Strift changed the title Fix tests for meilisearch v1.46.0 Increase timeout window when awaiting tasks Jun 9, 2026
@Strift Strift merged commit 218d8eb into main Jun 9, 2026
11 checks passed
@Strift Strift deleted the python-1215-update-test-suite-for-meilisearch-v1460 branch June 9, 2026 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Anything related to maintenance (CI, tests, refactoring...)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update test suite for Meilisearch v1.46.0

1 participant