From 321f62113251cc6efab3f58a16b155d953bb100d Mon Sep 17 00:00:00 2001 From: Binyamin Yawitz <316103+byawitz@users.noreply.github.com> Date: Fri, 7 Jun 2024 12:13:12 -0400 Subject: [PATCH] test: Functions tests --- app/cli.php | 12 +++--------- app/init2.php | 1 - src/Appwrite/Platform/Tasks/Migrate.php | 4 ++-- .../Services/Functions/FunctionsCustomClientTest.php | 3 ++- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/app/cli.php b/app/cli.php index 035565aaeb..60bf81b262 100644 --- a/app/cli.php +++ b/app/cli.php @@ -25,7 +25,6 @@ Runtime::enableCoroutine(SWOOLE_HOOK_ALL); * @var Registry $global * @var Container $container */ -$auth = new Dependency(); $register = new Dependency(); $logError = new Dependency(); $queueForDeletes = new Dependency(); @@ -93,11 +92,6 @@ $logError }); -$auth - ->setName('auth') - ->setCallback(fn () => new Authorization()); - -$container->set($auth); $container->set($logError); $container->set($register); $container->set($queueForDeletes); @@ -110,9 +104,9 @@ $cli = $platform->getCli(); $cli ->init() - ->inject('auth') - ->action(function (Authorization $auth) { - $auth->disable(); + ->inject('authorization') + ->action(function (Authorization $authorization) { + $authorization->disable(); }); $cli diff --git a/app/init2.php b/app/init2.php index 74b5bd2c83..c41ab7e203 100644 --- a/app/init2.php +++ b/app/init2.php @@ -3,7 +3,6 @@ require_once __DIR__ . '/../vendor/autoload.php'; use PHPMailer\PHPMailer\PHPMailer; -use Redis; use Utopia\Cache\Adapter\Redis as CacheRedis; use Utopia\Cache\Adapter\Sharding; use Utopia\VCS\Adapter\Git\GitHub; diff --git a/src/Appwrite/Platform/Tasks/Migrate.php b/src/Appwrite/Platform/Tasks/Migrate.php index f5a4d66994..e08985e1ae 100644 --- a/src/Appwrite/Platform/Tasks/Migrate.php +++ b/src/Appwrite/Platform/Tasks/Migrate.php @@ -32,8 +32,8 @@ class Migrate extends Action ->inject('dbForConsole') ->inject('getProjectDB') ->inject('register') - ->inject('auth') - ->callback(fn ($version, $cache, $dbForConsole, $getProjectDB, Registry $register, Authorization $auth) => $this->action($version, $cache, $dbForConsole, $getProjectDB, $register, $auth)); + ->inject('authorization') + ->callback(fn ($version, $cache, $dbForConsole, $getProjectDB, Registry $register, Authorization $authorization) => $this->action($version, $cache, $dbForConsole, $getProjectDB, $register, $authorization)); } private function clearProjectsCache(Cache $cache, Document $project) diff --git a/tests/e2e/Services/Functions/FunctionsCustomClientTest.php b/tests/e2e/Services/Functions/FunctionsCustomClientTest.php index 119c1a2223..1008c83ed5 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomClientTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomClientTest.php @@ -164,7 +164,8 @@ class FunctionsCustomClientTest extends Scope $this->assertEquals(202, $execution['headers']['status-code']); // Wait for the first scheduled execution to be created - sleep(65); + // Longer waiting time to cover all use-cases + sleep(119); $executions = $this->client->call(Client::METHOD_GET, '/functions/' . $function['body']['$id'] . '/executions', [ 'content-type' => 'application/json',