1
0
Fork 0
mirror of synced 2024-10-02 02:07:04 +13:00

Fix GraphQL function test

This commit is contained in:
Matej Bačo 2023-10-26 16:50:35 +02:00
parent 1d9b94ee4d
commit c3a80dcebc
3 changed files with 21 additions and 2 deletions

View file

@ -2,6 +2,8 @@
namespace Tests\E2E\Services\GraphQL;
use Utopia\CLI\Console;
trait Base
{
// Databases
@ -1933,4 +1935,13 @@ trait Base
throw new \InvalidArgumentException('Invalid query type');
}
// Function-related methods
protected string $stdout = '';
protected string $stderr = '';
protected function packageCode($folder)
{
Console::execute('cd ' . realpath(__DIR__ . "/../../../resources/functions") . "/$folder && tar --exclude code.tar.gz -czf code.tar.gz .", '', $this->stdout, $this->stderr);
}
}

View file

@ -82,7 +82,11 @@ class FunctionsClientTest extends Scope
{
$projectId = $this->getProject()['$id'];
$query = $this->getQuery(self::$CREATE_DEPLOYMENT);
$code = realpath(__DIR__ . '/../../../resources/functions') . "/php/code.tar.gz";
$folder = 'php';
$code = realpath(__DIR__ . '/../../../resources/functions') . "/$folder/code.tar.gz";
$this->packageCode($folder);
$gqlPayload = [
'operations' => \json_encode([
'query' => $query,

View file

@ -81,7 +81,11 @@ class FunctionsServerTest extends Scope
{
$projectId = $this->getProject()['$id'];
$query = $this->getQuery(self::$CREATE_DEPLOYMENT);
$code = realpath(__DIR__ . '/../../../resources/functions') . "/php/code.tar.gz";
$folder = 'php';
$code = realpath(__DIR__ . '/../../../resources/functions') . "/$folder/code.tar.gz";
$this->packageCode($folder);
$gqlPayload = [
'operations' => \json_encode([
'query' => $query,