Make index swap test more permissive#667
Conversation
WalkthroughA unit test in Changes
Sequence Diagram(s)(omitted — changes are limited to a unit test assertion and do not modify control flow) Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. 📜 Recent review detailsConfiguration used: CodeRabbit UI 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
tests/Meilisearch.Tests/IndexSwapTest.cs (2)
18-18: Fix indentation of [Fact] attribute for consistencyThe attribute is over-indented compared to the rest of the file. Align it with the surrounding members.
- [Fact] + [Fact]
23-24: Prefer structural JSON assertion over substring containmentThe switch to Assert.Contains makes the test less brittle than full JSON equality (good), but string-based JSON checks can still be flaky across serializers, formatting, or property ordering. Parsing the JSON and asserting on the "indexes" array keeps the test permissive while being robust to formatting differences.
- var json = JsonSerializer.Serialize(swap); - Assert.Contains("\"indexes\":[\"indexA\",\"indexB\"]", json); + var json = JsonSerializer.Serialize(swap); + using var doc = JsonDocument.Parse(json); + var indexesEl = doc.RootElement.GetProperty("indexes"); + Assert.Equal(JsonValueKind.Array, indexesEl.ValueKind); + Assert.Equal(2, indexesEl.GetArrayLength()); + var values = new List<string>(); + foreach (var el in indexesEl.EnumerateArray()) + { + values.Add(el.GetString()); + } + Assert.Equal(new[] { "indexA", "indexB" }, values);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
tests/Meilisearch.Tests/IndexSwapTest.cs(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
tests/Meilisearch.Tests/IndexSwapTest.cs (1)
tests/Meilisearch.Tests/MeilisearchClientTests.cs (16)
Fact(35-40)Fact(42-47)Fact(49-65)Fact(67-73)Fact(75-80)Fact(82-93)Fact(95-106)Fact(108-124)Fact(126-142)Fact(144-155)Fact(158-163)Fact(165-171)Fact(173-178)Fact(180-186)Fact(188-194)Fact(196-205)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: integration-tests
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
Build succeeded: |
Fix Meilisearch 1.18 tests run
Summary by CodeRabbit
Tests
Style