Skip to content

test(realtime): wait for the matching event when creating an index - #14432

Merged
ChiragAgg5k merged 1 commit into
mainfrom
fix/tests-realtime-index-create-race
Oct 13, 2026
Merged

ChiragAgg5k merged 1 commit into
mainfrom
fix/tests-realtime-index-create-race

Conversation

@ChiragAgg5k

@ChiragAgg5k ChiragAgg5k commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

RealtimeConsoleClientTest::testIndexesCollectionAPI failed on the 2.5.0 prep PR (#14422): Failed asserting that an array contains 'databases.….collections.….indexes.*.create' at line 621.

It's the race that 217bb21 fixed for the index delete tests. createCollectionWithAttribute() returns once a GET shows the attribute available, but the database worker can publish that attribute's available update after the GET returns. It then lands on the socket the test just opened, ahead of the index create event, and the test reads it as the index event.

The index create and index available reads in testIndexesCollectionAPI and testIndexesTablesAPI now use receiveUntilEvent(), which skips unrelated frames until the matching event arrives. The assertions on the matched event are unchanged.

Closes #14433

@luxor-code-review

luxor-code-review Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Review complete. No issues found — approved ✅.


This PR adds a single new e2e test exercising the Realtime service from the console-client side: it subscribes to collection attribute and index events and asserts streamed events arrive with the expected payloads and ordering.

Files Change
tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php New RealtimeConsoleClientTest e2e suite covering realtime subscription to collection attribute/index create and update events, using the shared receiveUntilEvent helper with bounded timeouts.

Reviewed commit: 098c7f0

@ghost

ghost commented Oct 13, 2026

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

The event-aware reads address the described ordering race and preserve the assertions for the expected index events.

Updated the collection and tables index realtime tests to wait for the matching create and available events while skipping unrelated websocket frames. The existing assertions on the matched event payloads and channels remain in place.

Verdict New comments Fixed Still open
✅ Approved 0 0 0
📂 Walkthrough · 1
File Change
tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php Use event-aware websocket reads for index creation and availability in both collection and tables tests.

Reviewed 098c7f0 · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Tier S · Looks good to merge. Summary

@github-actions

Copy link
Copy Markdown

Security rules

No new WARNING or ERROR findings from security rules.

19 existing findings tracked in .semgrep/baseline.json
  • php.appwrite.guest-write-without-abuse-limit (12)
  • php.appwrite.secret-compare-timing (5)
  • php.appwrite.weak-secret-env-default (2)

Posted by Checks / Rules. Re-runs update this comment in place. Rule details and baseline: .semgrep/README.md.

@github-actions

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → fix/tests-realtime-index-create-race (after).

Metric Before After Change
🚀 Requests/sec 202.27 212.53 🟢 +5.1%
⏱️ Latency P50 85.8 ms 82.17 ms ⚪ -4.2%
⏱️ Latency P95 200.05 ms 182.49 ms 🟢 -8.8%
Per-scenario breakdown & investigation details

Metrics below reflect the current branch (after). Δ P95 compares against the base.

Scenario P50 (ms) P95 (ms) Requests RPS Δ P95 (ms)
API total 82.17 182.49 13,395 212.53 -17.56
Account 155.47 268 705 11.72 -15.86
TablesDB 79.81 142.87 7,285 118.21 -22.08
Storage 75.34 163.32 3,525 59 -2.1
Functions 117.6 211.91 1,880 32.09 -16.85

Top API waits (after)

API request Max wait (ms)
functions.create 407.76
account.prefs.update 376.72
account.name.update 368.83
functions.variables.update 354.17
storage.buckets.create 319.39

@ChiragAgg5k
ChiragAgg5k merged commit 4492080 into main Oct 13, 2026
32 checks passed
@ChiragAgg5k
ChiragAgg5k deleted the fix/tests-realtime-index-create-race branch October 13, 2026 11:20
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.

Wait for the matching realtime event when creating an index in tests

1 participant