fix: revert test polling timeouts to original values

The root cause (PostgreSQL duplicate index race condition) has been
fixed in the database library, so the timeout workarounds are no
longer needed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jake Barnby
2026-03-14 21:00:36 +13:00
parent 1209a2e344
commit daaf1d7f77
4 changed files with 27 additions and 27 deletions
@@ -218,7 +218,7 @@ class DatabaseClientTest extends Scope
'x-appwrite-key' => $this->getProject()['apiKey'],
]);
$this->assertEquals('available', $response['body']['status']);
}, 240000, 500);
}, 30000, 250);
$this->assertEventually(function () use ($data) {
$response = $this->client->call(Client::METHOD_GET, '/databases/' . $data['database']['_id'] . '/collections/' . $data['collection']['_id'] . '/attributes/age', [
'content-type' => 'application/json',
@@ -226,7 +226,7 @@ class DatabaseClientTest extends Scope
'x-appwrite-key' => $this->getProject()['apiKey'],
]);
$this->assertEquals('available', $response['body']['status']);
}, 240000, 500);
}, 30000, 250);
$projectId = $this->getProject()['$id'];
$query = $this->getQuery(self::CREATE_DOCUMENT);
@@ -333,7 +333,7 @@ class DatabaseClientTest extends Scope
'x-appwrite-key' => $this->getProject()['apiKey'],
]);
$this->assertEquals('available', $response['body']['status']);
}, 240000, 500);
}, 30000, 250);
// Step 4: Create documents
$query = $this->getQuery(self::CREATE_DOCUMENTS);
@@ -635,7 +635,7 @@ class DatabaseClientTest extends Scope
'x-appwrite-key' => $this->getProject()['apiKey'],
]);
$this->assertEquals('available', $response['body']['status']);
}, 240000, 500);
}, 30000, 250);
$this->assertEventually(function () use ($data) {
$response = $this->client->call(Client::METHOD_GET, '/databases/' . $data['database']['_id'] . '/collections/' . $data['collection']['_id'] . '/attributes/age', [
'content-type' => 'application/json',
@@ -643,7 +643,7 @@ class DatabaseClientTest extends Scope
'x-appwrite-key' => $this->getProject()['apiKey'],
]);
$this->assertEquals('available', $response['body']['status']);
}, 240000, 500);
}, 30000, 250);
$projectId = $this->getProject()['$id'];
@@ -792,7 +792,7 @@ class RealtimeCustomClientTest extends Scope
'x-appwrite-key' => $this->getProject()['apiKey'],
]));
$this->assertEquals('available', $response['body']['status']);
}, 240000, 500);
}, 30000, 250);
/**
* Test Document Create
@@ -1376,7 +1376,7 @@ class RealtimeCustomClientTest extends Scope
'x-appwrite-key' => $this->getProject()['apiKey'],
]));
$this->assertEquals('available', $response['body']['status']);
}, 240000, 500);
}, 30000, 250);
// create
$this->client->call(Client::METHOD_POST, "/databases/{$databaseId}/collections/{$actorsId}/documents", array_merge([
@@ -1928,7 +1928,7 @@ class RealtimeCustomClientTest extends Scope
'x-appwrite-key' => $this->getProject()['apiKey'],
]));
$this->assertEquals('available', $response['body']['status']);
}, 240000, 500);
}, 30000, 250);
/**
* Test Document Create
@@ -2289,7 +2289,7 @@ class RealtimeCustomClientTest extends Scope
]);
$this->assertEquals('ready', $deployment['body']['status'], \json_encode($deployment['body']));
}, 240000, 500);
});
$response = $this->client->call(Client::METHOD_PATCH, '/functions/' . $functionId . '/deployments/' . $deploymentId, array_merge([
'content-type' => 'application/json',
@@ -2626,7 +2626,7 @@ class RealtimeCustomClientTest extends Scope
]));
$this->assertEquals('available', $attribute['body']['status']);
}, 240000, 500);
}, 30000, 250);
/**
* TablesDB table in the same database (/tablesdb API).
@@ -2669,7 +2669,7 @@ class RealtimeCustomClientTest extends Scope
$this->assertEquals(200, $column['headers']['status-code']);
$this->assertEquals('available', $column['body']['status']);
}, 240000, 500);
}, 120000, 500);
/**
* Two different clients subscribing via legacy (documents/collections)
@@ -2862,7 +2862,7 @@ class RealtimeCustomClientTest extends Scope
$this->assertEquals(200, $column['headers']['status-code']);
$this->assertEquals('available', $column['body']['status']);
}, 240000, 500);
}, 120000, 500);
$legacyRowId = ID::unique();
@@ -2976,7 +2976,7 @@ class RealtimeCustomClientTest extends Scope
$this->assertEquals(200, $column['headers']['status-code']);
$this->assertEquals('available', $column['body']['status']);
}, 240000, 500);
}, 120000, 500);
// Seed a row so we can listen to its update
$rowId = ID::unique();
@@ -3133,7 +3133,7 @@ class RealtimeCustomClientTest extends Scope
'x-appwrite-key' => $this->getProject()['apiKey'],
]));
$this->assertEquals('available', $response['body']['status']);
}, 240000, 500);
}, 30000, 250);
/**
* Test Transaction Create with Single Document
@@ -3342,7 +3342,7 @@ class RealtimeCustomClientTest extends Scope
'x-appwrite-key' => $this->getProject()['apiKey'],
]));
$this->assertEquals('available', $response['body']['status']);
}, 240000, 500);
}, 30000, 250);
/**
* Test Multiple Operations in Single Transaction
@@ -3498,7 +3498,7 @@ class RealtimeCustomClientTest extends Scope
'x-appwrite-key' => $this->getProject()['apiKey'],
]));
$this->assertEquals('available', $response['body']['status']);
}, 240000, 500);
}, 30000, 250);
/**
* Test Transaction Rollback - Should NOT trigger realtime events
@@ -3642,7 +3642,7 @@ class RealtimeCustomClientTest extends Scope
'x-appwrite-key' => $this->getProject()['apiKey'],
]));
$this->assertEquals('available', $response['body']['status']);
}, 240000, 500);
}, 30000, 250);
$this->assertEventually(function () use ($databaseId, $level2Id) {
$response = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $level2Id . '/attributes/name', array_merge([
@@ -3651,7 +3651,7 @@ class RealtimeCustomClientTest extends Scope
'x-appwrite-key' => $this->getProject()['apiKey'],
]));
$this->assertEquals('available', $response['body']['status']);
}, 240000, 500);
}, 30000, 250);
// two-way one-to-one relationship from level1 to level2
$this->client->call(Client::METHOD_POST, "/databases/{$databaseId}/collections/{$level1Id}/attributes/relationship", array_merge([
@@ -3673,7 +3673,7 @@ class RealtimeCustomClientTest extends Scope
'x-appwrite-key' => $this->getProject()['apiKey'],
]));
$this->assertEquals('available', $response['body']['status']);
}, 240000, 500);
}, 30000, 250);
$doc2 = $this->client->call(Client::METHOD_POST, "/databases/{$databaseId}/collections/{$level2Id}/documents", array_merge([
'content-type' => 'application/json',
@@ -3785,7 +3785,7 @@ class RealtimeCustomClientTest extends Scope
'x-appwrite-key' => $this->getProject()['apiKey'],
]));
$this->assertEquals('available', $response['body']['status'] ?? null);
}, 240000, 500);
}, 30000, 250);
Coroutine\run(function () use ($session, $projectId, $databaseId, $collectionId) {
$headers = [
+2 -2
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));
}, 200000, 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);
}, 120000, 500);
}
return $deploymentId;
+5 -5
View File
@@ -118,7 +118,7 @@ trait WebhooksBase
$this->assertCount(2, $collection['body']['attributes']);
$this->assertEquals('available', $collection['body']['attributes'][0]['status']);
$this->assertEquals('available', $collection['body']['attributes'][1]['status']);
}, 240000, 500);
}, 15000, 500);
return ['databaseId' => $databaseId, 'actorsId' => $actorsId];
}
@@ -192,7 +192,7 @@ trait WebhooksBase
$this->assertCount(2, $table['body']['columns']);
$this->assertEquals('available', $table['body']['columns'][0]['status']);
$this->assertEquals('available', $table['body']['columns'][1]['status']);
}, 240000, 500);
}, 15000, 500);
return ['databaseId' => $databaseId, 'actorsId' => $actorsId];
}
@@ -529,7 +529,7 @@ trait WebhooksBase
$this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Project-Id'] ?? '', $this->getProject()['$id']);
$this->assertNotEmpty($webhook['data']['key']);
$this->assertEquals($webhook['data']['key'], 'extra');
}, 240000, 500);
}, 15000, 500);
$removed = $this->client->call(Client::METHOD_DELETE, '/databases/' . $databaseId . '/collections/' . $actorsId . '/attributes/' . $extra['body']['key'], array_merge([
'content-type' => 'application/json',
@@ -896,7 +896,7 @@ trait WebhooksBase
$this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Project-Id'] ?? '', $this->getProject()['$id']);
$this->assertNotEmpty($webhook['data']['key']);
$this->assertEquals($webhook['data']['key'], 'extra');
}, 240000, 500);
}, 15000, 500);
$removed = $this->client->call(Client::METHOD_DELETE, '/tablesdb/' . $databaseId . '/tables/' . $actorsId . '/columns/' . $extra['body']['key'], array_merge([
'content-type' => 'application/json',
@@ -1829,6 +1829,6 @@ trait WebhooksBase
// assert that the webhook is now disabled after 10 consecutive failures
$this->assertEquals($webhook['body']['enabled'], false);
$this->assertEquals($webhook['body']['attempts'], 10);
}, 240000, 500);
}, 15000, 500);
}
}