merge master

This commit is contained in:
Prateek Banga
2023-09-12 20:53:16 +05:30
parent 40f419663c
commit cbea4264ea
3359 changed files with 64705 additions and 6301 deletions
@@ -26,6 +26,7 @@ class FunctionsClientTest extends Scope
'functionId' => ID::unique(),
'name' => 'Test Function',
'runtime' => 'php-8.0',
'entrypoint' => 'index.php',
'execute' => [Role::any()->toString()],
]
];
@@ -36,7 +37,6 @@ class FunctionsClientTest extends Scope
'x-appwrite-key' => $this->getProject()['apiKey'],
], $gqlPayload);
$this->assertIsArray($function['body']['data']);
$this->assertArrayNotHasKey('errors', $function['body']);
@@ -88,7 +88,6 @@ class FunctionsClientTest extends Scope
'query' => $query,
'variables' => [
'functionId' => $function['_id'],
'entrypoint' => 'index.php',
'activate' => true,
'code' => null,
]
@@ -108,9 +107,44 @@ class FunctionsClientTest extends Scope
$this->assertIsArray($deployment['body']['data']);
$this->assertArrayNotHasKey('errors', $deployment['body']);
sleep(15);
// Poll get deployment until an error, or status is either 'ready' or 'failed'
$deployment = $deployment['body']['data']['functionsCreateDeployment'];
$deploymentId = $deployment['_id'];
return $deployment['body']['data']['functionsCreateDeployment'];
$query = $this->getQuery(self::$GET_DEPLOYMENT);
$gqlPayload = [
'query' => $query,
'variables' => [
'functionId' => $function['_id'],
'deploymentId' => $deploymentId,
]
];
while (true) {
$deployment = $this->client->call(Client::METHOD_POST, '/graphql', [
'content-type' => 'application/json',
'x-appwrite-project' => $projectId,
'x-appwrite-key' => $this->getProject()['apiKey'],
], $gqlPayload);
$this->assertIsArray($deployment['body']['data']);
$this->assertArrayNotHasKey('errors', $deployment['body']);
$deployment = $deployment['body']['data']['functionsGetDeployment'];
if (
$deployment['status'] === 'ready'
|| $deployment['status'] === 'failed'
) {
break;
}
\sleep(1);
}
$this->assertEquals('ready', $deployment['status']);
return $deployment;
}
/**