diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 3581af2919..aac90c7efc 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -300,15 +300,26 @@ class FunctionsCustomServerTest extends Scope // Wait for deployment to build. sleep(15); + return array_merge($data, ['deploymentId' => $deploymentId]); + } + + /** + * @depends testUpdate + */ + public function testCreateDeploymentLarge($data): array { /** * Test for Large Code File SUCCESS */ - $source = realpath(__DIR__ . '/../../../resources/functions/php-large.tar.gz'); + + $folder = 'php-large'; + $code = realpath(__DIR__ . '/../../../resources/functions'). "/$folder/code.tar.gz"; + $this->packageCode($folder); + $chunkSize = 5*1024*1024; - $handle = @fopen($source, "rb"); + $handle = @fopen($code, "rb"); $mimeType = 'application/x-gzip'; $counter = 0; - $size = filesize($source); + $size = filesize($code); $headers = [ 'content-type' => 'multipart/form-data', 'x-appwrite-project' => $this->getProject()['$id'] @@ -334,12 +345,8 @@ class FunctionsCustomServerTest extends Scope $this->assertIsInt($largeTag['body']['dateCreated']); $this->assertEquals('index.php', $largeTag['body']['entrypoint']); $this->assertGreaterThan(10000, $largeTag['body']['size']); - - /** - * Test for FAILURE - */ - - return array_merge($data, ['deploymentId' => $deploymentId]); + + return $data; } /** diff --git a/tests/resources/functions/php-large.tar.gz b/tests/resources/functions/php-large/Blue - 27239.mp4 similarity index 98% rename from tests/resources/functions/php-large.tar.gz rename to tests/resources/functions/php-large/Blue - 27239.mp4 index 7ca5857029..638fe913a7 100644 Binary files a/tests/resources/functions/php-large.tar.gz and b/tests/resources/functions/php-large/Blue - 27239.mp4 differ diff --git a/tests/resources/functions/php-large/composer.json b/tests/resources/functions/php-large/composer.json new file mode 100644 index 0000000000..e3c6db23e9 --- /dev/null +++ b/tests/resources/functions/php-large/composer.json @@ -0,0 +1,18 @@ +{ + "name": "appwrite/cloud-function-demo", + "description": "Demo cloud function script", + "type": "library", + "license": "BSD-3-Clause", + "authors": [ + { + "name": "Team Appwrite", + "email": "team@appwrite.io" + } + ], + "require": { + "php": ">=7.4.0", + "ext-curl": "*", + "ext-json": "*", + "appwrite/appwrite": "1.1.*" + } +} diff --git a/tests/resources/functions/php-large/composer.lock b/tests/resources/functions/php-large/composer.lock new file mode 100644 index 0000000000..758c73c3f9 --- /dev/null +++ b/tests/resources/functions/php-large/composer.lock @@ -0,0 +1,64 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "afdff6a172e6c44aee11f1562175f81a", + "packages": [ + { + "name": "appwrite/appwrite", + "version": "1.1.2", + "source": { + "type": "git", + "url": "https://github.com/appwrite/sdk-for-php.git", + "reference": "98b327d3fd18a72f4582019916afd735a0e9e0e7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/appwrite/sdk-for-php/zipball/98b327d3fd18a72f4582019916afd735a0e9e0e7", + "reference": "98b327d3fd18a72f4582019916afd735a0e9e0e7", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "ext-json": "*", + "php": ">=7.1.0" + }, + "require-dev": { + "phpunit/phpunit": "3.7.35" + }, + "type": "library", + "autoload": { + "psr-4": { + "Appwrite\\": "src/Appwrite" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks", + "support": { + "email": "team@localhost.test", + "issues": "https://github.com/appwrite/sdk-for-php/issues", + "source": "https://github.com/appwrite/sdk-for-php/tree/1.1.2", + "url": "https://appwrite.io/support" + }, + "time": "2020-08-15T18:24:32+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=7.4.0", + "ext-curl": "*", + "ext-json": "*" + }, + "platform-dev": [], + "plugin-api-version": "2.0.0" +} diff --git a/tests/resources/functions/php-large/index.php b/tests/resources/functions/php-large/index.php new file mode 100644 index 0000000000..dd111af766 --- /dev/null +++ b/tests/resources/functions/php-large/index.php @@ -0,0 +1,15 @@ +json([ + 'APPWRITE_FUNCTION_ID' => $request['env']['APPWRITE_FUNCTION_ID'], + 'APPWRITE_FUNCTION_NAME' => $request['env']['APPWRITE_FUNCTION_NAME'], + 'APPWRITE_FUNCTION_DEPLOYMENT' => $request['env']['APPWRITE_FUNCTION_DEPLOYMENT'], + 'APPWRITE_FUNCTION_TRIGGER' => $request['env']['APPWRITE_FUNCTION_TRIGGER'], + 'APPWRITE_FUNCTION_RUNTIME_NAME' => $request['env']['APPWRITE_FUNCTION_RUNTIME_NAME'], + 'APPWRITE_FUNCTION_RUNTIME_VERSION' => $request['env']['APPWRITE_FUNCTION_RUNTIME_VERSION'], + 'APPWRITE_FUNCTION_EVENT' => $request['env']['APPWRITE_FUNCTION_EVENT'], + 'APPWRITE_FUNCTION_EVENT_DATA' => $request['env']['APPWRITE_FUNCTION_EVENT_DATA'], + 'UNICODE_TEST' => "êä" // TODO: Re-add unicode test to FunctionsCustomServerTest.php + ]); +};