mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
merge master
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user