mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Refactor command execution to use Utopia\Command
This commit is contained in:
@@ -8,6 +8,7 @@ use Tests\E2E\Client;
|
||||
use Tests\E2E\Scopes\ProjectCustom;
|
||||
use Tests\E2E\Scopes\Scope;
|
||||
use Tests\E2E\Scopes\SideServer;
|
||||
use Utopia\Command;
|
||||
use Utopia\Console;
|
||||
use Utopia\Database\Helpers\ID;
|
||||
use Utopia\Database\Helpers\Permission;
|
||||
@@ -83,7 +84,15 @@ class WebhooksCustomServerTest extends Scope
|
||||
$stdout = '';
|
||||
$folder = 'timeout';
|
||||
$code = realpath(__DIR__ . '/../../../resources/functions') . "/{$folder}/code.tar.gz";
|
||||
Console::execute('cd ' . realpath(__DIR__ . "/../../../resources/functions") . "/{$folder} && tar --exclude code.tar.gz --exclude node_modules -czf code.tar.gz .", '', $stdout, $stderr);
|
||||
$folderPath = realpath(__DIR__ . '/../../../resources/functions') . "/{$folder}";
|
||||
$packageFunctionCommand = (new Command('tar'))
|
||||
->option('--exclude', 'code.tar.gz')
|
||||
->option('--exclude', 'node_modules')
|
||||
->flag('-czf')
|
||||
->argument($code)
|
||||
->option('-C', $folderPath)
|
||||
->argument('.');
|
||||
Console::execute($packageFunctionCommand, '', $stdout, $stderr);
|
||||
|
||||
// Create variable first
|
||||
$this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/variables', array_merge([
|
||||
@@ -734,7 +743,15 @@ class WebhooksCustomServerTest extends Scope
|
||||
$stdout = '';
|
||||
$folder = 'timeout';
|
||||
$code = realpath(__DIR__ . '/../../../resources/functions') . "/{$folder}/code.tar.gz";
|
||||
Console::execute('cd ' . realpath(__DIR__ . "/../../../resources/functions") . "/{$folder} && tar --exclude code.tar.gz --exclude node_modules -czf code.tar.gz .", '', $stdout, $stderr);
|
||||
$folderPath = realpath(__DIR__ . '/../../../resources/functions') . "/{$folder}";
|
||||
$packageFunctionCommand = (new Command('tar'))
|
||||
->option('--exclude', 'code.tar.gz')
|
||||
->option('--exclude', 'node_modules')
|
||||
->flag('-czf')
|
||||
->argument($code)
|
||||
->option('-C', $folderPath)
|
||||
->argument('.');
|
||||
Console::execute($packageFunctionCommand, '', $stdout, $stderr);
|
||||
|
||||
$deployment = $this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/deployments', array_merge([
|
||||
'content-type' => 'multipart/form-data',
|
||||
|
||||
Reference in New Issue
Block a user