Fix GraphQL function test
This commit is contained in:
parent
1d9b94ee4d
commit
c3a80dcebc
3 changed files with 21 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue