From e75d5c3f13d016233f36c7ab70cd7a59c5279973 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 25 Aug 2026 18:22:27 +0530 Subject: [PATCH] fix(e2e): stop Databases testTimeout hanging on 12MB HTTP setup POSTs (#13339) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(e2e): stop testTimeout hanging on Expect 100-continue Databases PostgreSQL e2e flakes in testTimeout setup: ten ~12MB document POSTs stall libcurl's Expect: 100-continue handshake (status 100, 0 bytes, 120s) before the 408 assertion. Disable Expect on the test client and keep the fixture well under Swoole's 12MiB package_max_length. Co-authored-by: Chirag Aggarwal * fix(e2e): keep testTimeout under Swoole's 12MiB HTTP ceiling Disabling Expect: 100-continue changed the flake from status 100 to status 0 — ten ~12MB creates still hang under paratest --processes 3. Use a 1MiB slice and Query::contains so the 1ms statement_timeout still yields 408 without posting at package_max_length. Co-authored-by: Chirag Aggarwal * fix(e2e): drop global Expect header that 413s Storage uploads Empty Expect: made curl send multipart bodies immediately. Traefik/Swoole RST the connection, so Client threw on testCreateBucketFile instead of returning 413. testTimeout is fixed by the 1MiB slice and contains() query. Co-authored-by: Chirag Aggarwal --------- Co-authored-by: Cursor Agent --- tests/e2e/Services/Databases/DatabasesBase.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/e2e/Services/Databases/DatabasesBase.php b/tests/e2e/Services/Databases/DatabasesBase.php index d7cf365bd7..801d19fce8 100644 --- a/tests/e2e/Services/Databases/DatabasesBase.php +++ b/tests/e2e/Services/Databases/DatabasesBase.php @@ -7631,14 +7631,21 @@ trait DatabasesBase $this->waitForAttribute($data['databaseId'], $data['$id'], 'longtext'); } + // The fixture is ~12MB, just under Swoole's 12MiB package_max_length / + // output_buffer_size. Ten concurrent HTTP creates of that size never + // complete under paratest (curl: 0 bytes, 120s) — isolated they take ~1s + // each. A 1MiB slice plus contains() still exceeds statement_timeout=1ms + // (notEqual on 1MiB returned 200 on DocumentsDB). + $longtext = substr(file_get_contents(__DIR__ . '/../../../resources/longtext.txt'), 0, 1024 * 1024); + for ($i = 0; $i < 10; $i++) { - $this->client->call(Client::METHOD_POST, $this->getRecordUrl($data['databaseId'], $data['$id']), array_merge([ + $document = $this->client->call(Client::METHOD_POST, $this->getRecordUrl($data['databaseId'], $data['$id']), array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ $this->getRecordIdParam() => ID::unique(), 'data' => [ - 'longtext' => file_get_contents(__DIR__ . '/../../../resources/longtext.txt'), + 'longtext' => $longtext, ], 'permissions' => [ Permission::read(Role::user($this->getUser()['$id'])), @@ -7646,6 +7653,7 @@ trait DatabasesBase Permission::delete(Role::user($this->getUser()['$id'])), ] ]); + $this->assertEquals(201, $document['headers']['status-code']); } $response = $this->client->call(Client::METHOD_GET, $this->getRecordUrl($data['databaseId'], $data['$id']), array_merge([ @@ -7654,7 +7662,7 @@ trait DatabasesBase 'x-appwrite-timeout' => 1, ], $this->getHeaders()), [ 'queries' => [ - Query::notEqual('longtext', 'appwrite')->toString(), + Query::contains('longtext', ['needle-that-does-not-exist'])->toString(), ], ]);