From 84c40cea4137b404e8b09dd12829c5fcfcb4083e Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 18 Feb 2026 15:25:45 +1300 Subject: [PATCH] fix: resolve testCreateAttributes, testUpsertDocument, and SchemaPolling timeouts - Fix testCreateAttributes: use $actorsAttr instead of undefined $actors variable, and use $this->getSchemaResource() instead of hardcoded 'attributes' for TablesDB compat - Fix testUpsertDocument: add missing 'data' => $upsertData in PUT request body - Increase SchemaPolling default timeout from 60s to 120s for CI stability with spatial attributes under parallel load Co-Authored-By: Claude Opus 4.6 --- tests/e2e/Scopes/SchemaPolling.php | 12 ++++---- .../e2e/Services/Databases/DatabasesBase.php | 30 ++++++++++--------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/tests/e2e/Scopes/SchemaPolling.php b/tests/e2e/Scopes/SchemaPolling.php index 4a8a79c070..36c4b7592a 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 = 60000, int $waitMs = 500): void + protected function waitForAttribute(string $databaseId, string $containerId, string $attributeKey, int $timeoutMs = 120000, 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 = 60000, int $waitMs = 500): void + protected function waitForAttributes(string $databaseId, string $containerId, array $attributeKeys, int $timeoutMs = 120000, 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 = 60000, int $waitMs = 500): void + protected function waitForAttributeCount(string $databaseId, string $containerId, int $count, int $timeoutMs = 120000, 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 = 60000, int $waitMs = 500): void + protected function waitForIndex(string $databaseId, string $containerId, string $indexKey, int $timeoutMs = 120000, 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 = 60000, int $waitMs = 500): void + protected function waitForAllIndexes(string $databaseId, string $containerId, int $timeoutMs = 120000, int $waitMs = 500): void { $this->assertEventually(function () use ($databaseId, $containerId) { $container = $this->client->call( @@ -185,7 +185,7 @@ trait SchemaPolling * @param int $timeoutMs Maximum time to wait in milliseconds (default 10 minutes for CI stability under parallel load) * @param int $waitMs Time between polling attempts in milliseconds */ - protected function waitForAllAttributes(string $databaseId, string $containerId, int $timeoutMs = 60000, int $waitMs = 500): void + protected function waitForAllAttributes(string $databaseId, string $containerId, int $timeoutMs = 120000, int $waitMs = 500): void { $this->assertEventually(function () use ($databaseId, $containerId) { $container = $this->client->call( diff --git a/tests/e2e/Services/Databases/DatabasesBase.php b/tests/e2e/Services/Databases/DatabasesBase.php index 16e573d4b4..582367304c 100644 --- a/tests/e2e/Services/Databases/DatabasesBase.php +++ b/tests/e2e/Services/Databases/DatabasesBase.php @@ -1028,25 +1028,26 @@ trait DatabasesBase 'x-appwrite-key' => $this->getProject()['apiKey'] ])); - $this->assertIsArray($movies['body']['attributes']); - $this->assertCount($this->getSupportForRelationships() ? 10 : 9, $movies['body']['attributes']); + $schemaResource = $this->getSchemaResource(); + $this->assertIsArray($movies['body'][$schemaResource]); + $this->assertCount($this->getSupportForRelationships() ? 10 : 9, $movies['body'][$schemaResource]); $this->assertArrayHasKey('bytesMax', $movies['body']); $this->assertArrayHasKey('bytesUsed', $movies['body']); $this->assertGreaterThanOrEqual(0, $movies['body']['bytesUsed']); - $this->assertEquals($movies['body']['attributes'][0]['key'], $title['body']['key']); - $this->assertEquals($movies['body']['attributes'][1]['key'], $description['body']['key']); - $this->assertEquals($movies['body']['attributes'][2]['key'], $tagline['body']['key']); - $this->assertEquals($movies['body']['attributes'][3]['key'], $releaseYear['body']['key']); - $this->assertEquals($movies['body']['attributes'][4]['key'], $duration['body']['key']); - $this->assertEquals($movies['body']['attributes'][5]['key'], $actors['body']['key']); - $this->assertEquals($movies['body']['attributes'][6]['key'], $datetime['body']['key']); + $this->assertEquals($movies['body'][$schemaResource][0]['key'], $title['body']['key']); + $this->assertEquals($movies['body'][$schemaResource][1]['key'], $description['body']['key']); + $this->assertEquals($movies['body'][$schemaResource][2]['key'], $tagline['body']['key']); + $this->assertEquals($movies['body'][$schemaResource][3]['key'], $releaseYear['body']['key']); + $this->assertEquals($movies['body'][$schemaResource][4]['key'], $duration['body']['key']); + $this->assertEquals($movies['body'][$schemaResource][5]['key'], $actorsAttr['body']['key']); + $this->assertEquals($movies['body'][$schemaResource][6]['key'], $datetime['body']['key']); if (!$this->getSupportForRelationships()) { - $this->assertEquals($movies['body']['attributes'][7]['key'], $integers['body']['key']); - $this->assertEquals($movies['body']['attributes'][8]['key'], $integers2['body']['key']); + $this->assertEquals($movies['body'][$schemaResource][7]['key'], $integers['body']['key']); + $this->assertEquals($movies['body'][$schemaResource][8]['key'], $integers2['body']['key']); } else { - $this->assertEquals($movies['body']['attributes'][7]['key'], $relationship['body']['key']); - $this->assertEquals($movies['body']['attributes'][8]['key'], $integers['body']['key']); - $this->assertEquals($movies['body']['attributes'][9]['key'], $integers2['body']['key']); + $this->assertEquals($movies['body'][$schemaResource][7]['key'], $relationship['body']['key']); + $this->assertEquals($movies['body'][$schemaResource][8]['key'], $integers['body']['key']); + $this->assertEquals($movies['body'][$schemaResource][9]['key'], $integers2['body']['key']); } } @@ -2517,6 +2518,7 @@ trait DatabasesBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ + 'data' => $upsertData, 'permissions' => [ Permission::read(Role::users()), Permission::update(Role::users()),