From 1ef96627d340f949227557ca9720eef663147c3a Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 6 Feb 2026 03:04:22 +1300 Subject: [PATCH] fix: scale databases worker to handle parallel test load The root cause of flaky attribute processing tests is that a single appwrite-worker-databases container cannot keep up with attribute creation jobs when tests run in parallel via paratest. This fix: - Scales the databases worker to 4 instances during E2E service tests - Reverts timeout increases that masked the underlying issue Co-Authored-By: Claude Opus 4.5 --- .github/workflows/tests.yml | 4 ++-- tests/e2e/Scopes/SchemaPolling.php | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1aa431bfc0..ab65fb78cb 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -201,7 +201,7 @@ jobs: run: | docker load --input /tmp/${{ env.IMAGE }}.tar sed -i 's|^_APP_BROWSER_HOST=.*|_APP_BROWSER_HOST=http://invalid-browser/v1|' .env - docker compose up -d + docker compose up -d --scale appwrite-worker-databases=4 sleep 30 - name: Wait for Open Runtimes @@ -284,7 +284,7 @@ jobs: - name: Load and Start Appwrite run: | docker load --input /tmp/${{ env.IMAGE }}.tar - docker compose up -d + docker compose up -d --scale appwrite-worker-databases=4 sleep 30 - name: Wait for Open Runtimes diff --git a/tests/e2e/Scopes/SchemaPolling.php b/tests/e2e/Scopes/SchemaPolling.php index 906310b820..6f8197d9b8 100644 --- a/tests/e2e/Scopes/SchemaPolling.php +++ b/tests/e2e/Scopes/SchemaPolling.php @@ -19,7 +19,7 @@ trait SchemaPolling * @param int $timeoutMs Maximum time to wait in milliseconds * @param int $waitMs Time between polling attempts in milliseconds */ - protected function waitForAttribute(string $databaseId, string $containerId, string $attributeKey, int $timeoutMs = 600000, int $waitMs = 500): void + protected function waitForAttribute(string $databaseId, string $containerId, string $attributeKey, int $timeoutMs = 180000, int $waitMs = 500): void { $this->assertEventually(function () use ($databaseId, $containerId, $attributeKey) { $attribute = $this->client->call( @@ -46,7 +46,7 @@ trait SchemaPolling * @param int $timeoutMs Maximum time to wait in milliseconds * @param int $waitMs Time between polling attempts in milliseconds */ - protected function waitForAttributes(string $databaseId, string $containerId, array $attributeKeys, int $timeoutMs = 600000, int $waitMs = 500): void + protected function waitForAttributes(string $databaseId, string $containerId, array $attributeKeys, int $timeoutMs = 180000, int $waitMs = 500): void { $this->assertEventually(function () use ($databaseId, $containerId, $attributeKeys) { $container = $this->client->call( @@ -87,7 +87,7 @@ trait SchemaPolling * @param int $timeoutMs Maximum time to wait in milliseconds * @param int $waitMs Time between polling attempts in milliseconds */ - protected function waitForAttributeCount(string $databaseId, string $containerId, int $count, int $timeoutMs = 600000, int $waitMs = 500): void + protected function waitForAttributeCount(string $databaseId, string $containerId, int $count, int $timeoutMs = 180000, int $waitMs = 500): void { $this->assertEventually(function () use ($databaseId, $containerId, $count) { $container = $this->client->call( @@ -126,7 +126,7 @@ trait SchemaPolling * @param int $timeoutMs Maximum time to wait in milliseconds * @param int $waitMs Time between polling attempts in milliseconds */ - protected function waitForIndex(string $databaseId, string $containerId, string $indexKey, int $timeoutMs = 600000, int $waitMs = 500): void + protected function waitForIndex(string $databaseId, string $containerId, string $indexKey, int $timeoutMs = 180000, int $waitMs = 500): void { $this->assertEventually(function () use ($databaseId, $containerId, $indexKey) { $index = $this->client->call( @@ -154,7 +154,7 @@ trait SchemaPolling * @param int $timeoutMs Maximum time to wait in milliseconds * @param int $waitMs Time between polling attempts in milliseconds */ - protected function waitForAllIndexes(string $databaseId, string $containerId, int $timeoutMs = 600000, int $waitMs = 500): void + protected function waitForAllIndexes(string $databaseId, string $containerId, int $timeoutMs = 180000, int $waitMs = 500): void { $this->assertEventually(function () use ($databaseId, $containerId) { $container = $this->client->call( @@ -182,10 +182,10 @@ trait SchemaPolling * * @param string $databaseId The database ID * @param string $containerId The collection/table ID - * @param int $timeoutMs Maximum time to wait in milliseconds (default 10 minutes for CI stability) + * @param int $timeoutMs Maximum time to wait in milliseconds (default 3 minutes for CI stability) * @param int $waitMs Time between polling attempts in milliseconds */ - protected function waitForAllAttributes(string $databaseId, string $containerId, int $timeoutMs = 600000, int $waitMs = 500): void + protected function waitForAllAttributes(string $databaseId, string $containerId, int $timeoutMs = 180000, int $waitMs = 500): void { $this->assertEventually(function () use ($databaseId, $containerId) { $container = $this->client->call(