From 52606f352c5d02b138c084d896f7dcc6ade7063c Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 13 Feb 2026 10:37:07 +1300 Subject: [PATCH] fix: handle 401 in assertEventually and increase curl timeout to 30s - setupDeployment's assertEventually callbacks now handle 401 responses gracefully instead of crashing with "Undefined array key" - Increase Client curl timeout from 15s to 30s for slow CI runners (testDeleteScheduledExecution and testGetScreenshotWithPermissions were hitting the 15s limit) Co-Authored-By: Claude Opus 4.6 --- tests/e2e/Client.php | 2 +- tests/e2e/Services/Functions/FunctionsBase.php | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/e2e/Client.php b/tests/e2e/Client.php index 6b81713654..c4601e1a9c 100644 --- a/tests/e2e/Client.php +++ b/tests/e2e/Client.php @@ -210,7 +210,7 @@ class Client curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36'); curl_setopt($ch, CURLOPT_HTTPHEADER, $formattedHeaders); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0); - curl_setopt($ch, CURLOPT_TIMEOUT, 15); + curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_HEADERFUNCTION, function ($curl, $header) use (&$responseHeaders, &$cookies) { $len = strlen($header); $header = explode(':', $header, 2); diff --git a/tests/e2e/Services/Functions/FunctionsBase.php b/tests/e2e/Services/Functions/FunctionsBase.php index 0d53cecf24..0f146ee721 100644 --- a/tests/e2e/Services/Functions/FunctionsBase.php +++ b/tests/e2e/Services/Functions/FunctionsBase.php @@ -72,7 +72,8 @@ trait FunctionsBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'], ])); - $this->assertEquals('ready', $deployment['body']['status'], 'Deployment status is not ready, deployment: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); + $this->assertNotEquals(401, $deployment['headers']['status-code'], 'Auth failed while polling deployment status'); + $this->assertEquals('ready', $deployment['body']['status'] ?? '', 'Deployment status is not ready, deployment: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); }, 100000, 500); // Not === so multipart/form-data works fine too @@ -83,7 +84,8 @@ trait FunctionsBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'], ])); - $this->assertEquals($deploymentId, $function['body']['deploymentId'], 'Deployment is not activated, deployment: ' . json_encode($function['body'], JSON_PRETTY_PRINT)); + $this->assertNotEquals(401, $function['headers']['status-code'], 'Auth failed while polling function activation'); + $this->assertEquals($deploymentId, $function['body']['deploymentId'] ?? '', 'Deployment is not activated, deployment: ' . json_encode($function['body'], JSON_PRETTY_PRINT)); }, 100000, 500); }