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 <noreply@anthropic.com>
This commit is contained in:
Jake Barnby
2026-02-18 15:25:45 +13:00
parent 9796c46975
commit 84c40cea41
2 changed files with 22 additions and 20 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 = 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(
+16 -14
View File
@@ -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()),