diff --git a/.env b/.env index b1042fa05b..581af6d978 100644 --- a/.env +++ b/.env @@ -30,7 +30,7 @@ _APP_SMTP_USERNAME= _APP_SMTP_PASSWORD= _APP_STORAGE_LIMIT=10000000 _APP_FUNCTIONS_TIMEOUT=900 -_APP_FUNCTIONS_CONTAINERS=100 +_APP_FUNCTIONS_CONTAINERS=10 _APP_FUNCTIONS_CPUS=1 _APP_FUNCTIONS_MEMORY=256 _APP_FUNCTIONS_MEMORY_SWAP=256 diff --git a/tests/e2e/Services/Functions/XFunctionsCustomClientTest.php b/tests/e2e/Services/Functions/FunctionsCustomClientTest.php similarity index 91% rename from tests/e2e/Services/Functions/XFunctionsCustomClientTest.php rename to tests/e2e/Services/Functions/FunctionsCustomClientTest.php index e5bbf37300..0d71279bce 100644 --- a/tests/e2e/Services/Functions/XFunctionsCustomClientTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomClientTest.php @@ -80,9 +80,9 @@ class FunctionsCustomClientTest extends Scope ]); $tagId = $tag['body']['$id'] ?? ''; - + $this->assertEquals(201, $tag['headers']['status-code']); - + $function = $this->client->call(Client::METHOD_PATCH, '/functions/'.$function['body']['$id'].'/tag', [ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], @@ -90,7 +90,7 @@ class FunctionsCustomClientTest extends Scope ], [ 'tag' => $tagId, ]); - + $this->assertEquals(200, $function['headers']['status-code']); $execution = $this->client->call(Client::METHOD_POST, '/functions/'.$function['body']['$id'].'/executions', [ @@ -112,7 +112,7 @@ class FunctionsCustomClientTest extends Scope $executionId = $execution['body']['$id'] ?? ''; $this->assertEquals(201, $execution['headers']['status-code']); - + return []; } @@ -127,7 +127,7 @@ class FunctionsCustomClientTest extends Scope $function = $this->client->call(Client::METHOD_POST, '/functions', [ 'content-type' => 'application/json', 'x-appwrite-project' => $projectId, - 'x-appwrite-key' => $apikey, + 'x-appwrite-key' => $apikey, ], [ 'name' => 'Test', 'execute' => ['*'], @@ -146,46 +146,41 @@ class FunctionsCustomClientTest extends Scope $tag = $this->client->call(Client::METHOD_POST, '/functions/'.$functionId.'/tags', [ 'content-type' => 'multipart/form-data', - 'x-appwrite-project' => $projectId, - 'x-appwrite-key' => $apikey, + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $apikey, ], [ 'command' => 'php index.php', 'code' => new CURLFile(realpath(__DIR__ . '/../../../resources/functions/php-fn.tar.gz'), 'application/x-gzip', 'php-fx.tar.gz'), //different tarball names intentional ]); $tagId = $tag['body']['$id'] ?? ''; - + $this->assertEquals(201, $tag['headers']['status-code']); - + $function = $this->client->call(Client::METHOD_PATCH, '/functions/'.$functionId.'/tag', [ 'content-type' => 'application/json', - 'x-appwrite-project' => $projectId, - 'x-appwrite-key' => $apikey, + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $apikey, ], [ 'tag' => $tagId, ]); - + $this->assertEquals(200, $function['headers']['status-code']); $execution = $this->client->call(Client::METHOD_POST, '/functions/'.$functionId.'/executions', array_merge([ 'content-type' => 'application/json', - 'x-appwrite-project' => $projectId, + 'x-appwrite-project' => $projectId, ], $this->getHeaders()), [ 'data' => 'foobar', ]); $this->assertEquals(201, $execution['headers']['status-code']); - fwrite(STDERR, "."); - sleep(60); - fwrite(STDERR, "."); - $executions = $this->client->call(Client::METHOD_GET, '/functions/'.$functionId.'/executions', [ 'content-type' => 'application/json', - 'x-appwrite-project' => $projectId, - 'x-appwrite-key' => $apikey, + 'x-appwrite-project' => $projectId, + 'x-appwrite-key' => $apikey, ]); - var_dump($executions['body']['executions']); $this->assertEquals(200, $executions['headers']['status-code']); $this->assertStringContainsString('foobar', $executions['body']['executions'][0]['stdout']);