From 385e4e14b881d4755e7aa9bf5fd69a2f931b68ac Mon Sep 17 00:00:00 2001 From: Darshan Date: Tue, 1 Jul 2025 17:33:11 +0530 Subject: [PATCH 1/2] add: delay, retries. --- .../Databases/DatabasesCustomServerTest.php | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/tests/e2e/Services/Databases/DatabasesCustomServerTest.php b/tests/e2e/Services/Databases/DatabasesCustomServerTest.php index e84c760c86..b38b1202c6 100644 --- a/tests/e2e/Services/Databases/DatabasesCustomServerTest.php +++ b/tests/e2e/Services/Databases/DatabasesCustomServerTest.php @@ -1470,9 +1470,24 @@ class DatabasesCustomServerTest extends Scope $this->assertCount(64, $collection['body']['attributes']); $this->assertCount(0, $collection['body']['indexes']); - foreach ($collection['body']['attributes'] as $attribute) { - $this->assertEquals('available', $attribute['status'], 'attribute: ' . $attribute['key']); - } + $this->assertEventually(function () use ($databaseId, $collectionId) { + $collection = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $collectionId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ])); + + foreach ($collection['body']['attributes'] ?? [] as $attribute) { + $this->assertEquals( + 'available', + $attribute['status'], + 'attribute: ' . $attribute['key'] + ); + } + + return true; + }, 60000, 500); + // Test indexLimit = 64 // MariaDB, MySQL, and MongoDB create 6 indexes per new collection From 4d0bd1d74fb0d572b3838aca9526123f0a101e61 Mon Sep 17 00:00:00 2001 From: Darshan Date: Tue, 1 Jul 2025 18:10:19 +0530 Subject: [PATCH 2/2] add: delay, retries. --- tests/e2e/Services/Databases/DatabasesBase.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/tests/e2e/Services/Databases/DatabasesBase.php b/tests/e2e/Services/Databases/DatabasesBase.php index e34691839d..a9a6c6e1db 100644 --- a/tests/e2e/Services/Databases/DatabasesBase.php +++ b/tests/e2e/Services/Databases/DatabasesBase.php @@ -1414,9 +1414,20 @@ trait DatabasesBase $this->assertEquals($releaseYearIndex['body']['key'], $movies['body']['indexes'][1]['key']); $this->assertEquals($releaseWithDate1['body']['key'], $movies['body']['indexes'][2]['key']); $this->assertEquals($releaseWithDate2['body']['key'], $movies['body']['indexes'][3]['key']); - foreach ($movies['body']['indexes'] as $index) { - $this->assertEquals('available', $index['status']); - } + + $this->assertEventually(function () use ($databaseId, $data) { + $movies = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $data['moviesId'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ])); + + foreach ($movies['body']['indexes'] as $index) { + $this->assertEquals('available', $index['status']); + } + + return true; + }, 60000, 500); return $data; }