fix: resolve test failures and reduce excessive timeouts

- DatabasesBase: fix 5 merge corruption issues (missing integers2 attr,
  undefined vars, wrong assertion, wrong setup method)
- WebhooksBase: increase deployment build timeout from 10s to 120s
- RealtimeBase: reduce WebSocket timeout 120s→30s, fix deprecated nullable
- RealtimeConsoleClientTest: reduce assertEventually 120s→30s
- SchemaPolling: reduce all default timeouts 600s→60s
- SitesBase: reduce build timeout 300s→120s, activation 200s→60s

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jake Barnby
2026-02-18 14:23:42 +13:00
co-authored by Claude Opus 4.6
parent a70e94a67b
commit acad17f3b8
6 changed files with 31 additions and 23 deletions
+6 -6
View File
@@ -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 = 60000, 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 = 60000, 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 = 60000, 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 = 60000, 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 = 60000, 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 = 600000, int $waitMs = 500): void
protected function waitForAllAttributes(string $databaseId, string $containerId, int $timeoutMs = 60000, int $waitMs = 500): void
{
$this->assertEventually(function () use ($databaseId, $containerId) {
$container = $this->client->call(
+14 -6
View File
@@ -1966,6 +1966,13 @@ trait DatabasesBase
]), ['key' => 'integers', 'required' => false, 'array' => true, 'min' => 10, 'max' => 99]);
$this->assertEquals(202, $integers['headers']['status-code']);
$integers2 = $this->client->call(Client::METHOD_POST, $this->getSchemaUrl($databaseId, $collectionId) . '/integer', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey']
]), ['key' => 'integers2', 'required' => false, 'array' => true, 'min' => 10, 'max' => 99]);
$this->assertEquals(202, $integers2['headers']['status-code']);
// Wait for attributes to be ready
$this->waitForAllAttributes($databaseId, $collectionId);
@@ -2494,7 +2501,7 @@ trait DatabasesBase
/**
* Resubmit same document, nothing to update
*/
$this->assertIsString($document1['body']['$sequence']);
$this->assertIsString($document['body']['$sequence']);
$upsertData = [
'title' => 'Thor: Ragnarok',
'releaseYear' => 2000,
@@ -3156,7 +3163,7 @@ trait DatabasesBase
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals($document['title'], $response['body']['title']);
$this->assertEquals($document['releaseYear'], $response['body']['releaseYear']);
$this->assertArrayNotHasKey('birthDay', $response['body']);
$this->assertArrayHasKey('birthDay', $response['body']);
$this->assertArrayHasKey('$sequence', $response['body']);
// Query by sequence on get single document route
@@ -5955,7 +5962,7 @@ trait DatabasesBase
return;
}
$data = $this->setupOneToOneRelationship();
$data = $this->setupOneToManyRelationship();
$databaseId = $data['databaseId'];
$personCollection = $data['personCollection'];
$libraryCollection = $data['libraryCollection'];
@@ -6642,11 +6649,9 @@ trait DatabasesBase
return;
}
$data = $this->setupDatabase();
$databaseId = $data['databaseId'];
$this->assertEquals(201, $database['headers']['status-code']);
$databaseId = $database['body']['$id'];
$collection1 = $this->client->call(Client::METHOD_POST, $this->getContainerUrl($databaseId), array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
@@ -6698,6 +6703,9 @@ trait DatabasesBase
'required' => true,
]);
$this->waitForAttribute($databaseId, $collection1, 'name');
$this->waitForAttribute($databaseId, $collection2, 'name');
$this->client->call(Client::METHOD_POST, $this->getSchemaUrl($databaseId, $collection1) . '/relationship', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
+2 -2
View File
@@ -10,7 +10,7 @@ trait RealtimeBase
private function getWebsocket(
array $channels = [],
array $headers = [],
string $projectId = null,
?string $projectId = null,
?array $queries = null
): WebSocketClient {
if (is_null($projectId)) {
@@ -63,7 +63,7 @@ trait RealtimeBase
"ws://appwrite.test/v1/realtime?" . $queryString,
[
"headers" => $headers,
"timeout" => 120,
"timeout" => 30,
]
);
}
@@ -68,7 +68,7 @@ class RealtimeConsoleClientTest extends Scope
], $this->getHeaders()));
$this->assertEquals(200, $attribute['headers']['status-code']);
$this->assertEquals('available', $attribute['body']['status']);
}, 120000, 500);
}, 30000, 500);
return ['actorsId' => $actorsId, 'databaseId' => $databaseId];
}
@@ -120,7 +120,7 @@ class RealtimeConsoleClientTest extends Scope
], $this->getHeaders()));
$this->assertEquals(200, $column['headers']['status-code']);
$this->assertEquals('available', $column['body']['status']);
}, 120000, 500);
}, 30000, 500);
return ['actorsId' => $actorsId, 'databaseId' => $databaseId];
}
@@ -151,7 +151,7 @@ class RealtimeConsoleClientTest extends Scope
], $this->getHeaders()));
$this->assertEquals(200, $index['headers']['status-code'], 'Index polling returned ' . $index['headers']['status-code'] . ': ' . json_encode($index['body'] ?? ''));
$this->assertEquals('available', $index['body']['status']);
}, 120000, 500);
}, 30000, 500);
return $data;
}
@@ -182,7 +182,7 @@ class RealtimeConsoleClientTest extends Scope
], $this->getHeaders()));
$this->assertEquals(200, $index['headers']['status-code'], 'Index polling returned ' . $index['headers']['status-code'] . ': ' . json_encode($index['body'] ?? ''));
$this->assertEquals('available', $index['body']['status']);
}, 120000, 500);
}, 30000, 500);
return $data;
}
+4 -4
View File
@@ -65,7 +65,7 @@ trait SitesBase
}
$this->assertEquals('ready', $deployment['body']['status'], 'Deployment status is not ready, deployment: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT));
}, 300000, 500);
}, 120000, 500);
// Not === so multipart/form-data works fine too
if (($params['activate'] ?? false) == true) {
@@ -76,7 +76,7 @@ trait SitesBase
'x-appwrite-key' => $this->getProject()['apiKey'],
]));
$this->assertEquals($deploymentId, $site['body']['deploymentId'], 'Deployment is not activated, deployment: ' . json_encode($site['body'], JSON_PRETTY_PRINT));
}, 200000, 500);
}, 60000, 500);
}
return $deploymentId;
@@ -281,12 +281,12 @@ trait SitesBase
$this->assertEventually(function () use ($siteId, $deploymentId) {
$deployment = $this->getDeployment($siteId, $deploymentId);
$this->assertEquals('ready', $deployment['body']['status'], 'Deployment status is not ready, deployment: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT));
}, 150000, 500);
}, 120000, 500);
$this->assertEventually(function () use ($siteId, $deploymentId) {
$site = $this->getSite($siteId);
$this->assertEquals($deploymentId, $site['body']['deploymentId'], 'Deployment is not activated, deployment: ' . json_encode($site['body'], JSON_PRETTY_PRINT));
}, 100000, 500);
}, 60000, 500);
return $deploymentId;
}
+1 -1
View File
@@ -26,7 +26,7 @@ trait WebhooksBase
$this->assertEquals(200, $deployment['headers']['status-code']);
$this->assertEquals('ready', $deployment['body']['status'], \json_encode($deployment['body']));
});
}, 120000, 500);
}
public static function getWebhookSignature(array $webhook, string $signatureKey): string