test: execution is completed
This commit is contained in:
parent
865b12ba9d
commit
cfdd40dbeb
1 changed files with 13 additions and 1 deletions
|
@ -246,7 +246,7 @@ class FunctionsCustomClientTest extends Scope
|
||||||
$this->assertEquals(200, $function['headers']['status-code']);
|
$this->assertEquals(200, $function['headers']['status-code']);
|
||||||
|
|
||||||
// Schedule execution for the future
|
// Schedule execution for the future
|
||||||
$futureTime = (new \DateTime())->add(new \DateInterval('PT1M'))->format('Y-m-d H:i:s');
|
$futureTime = (new \DateTime())->add(new \DateInterval('PT10S'))->format('Y-m-d H:i:s');
|
||||||
$execution = $this->client->call(Client::METHOD_POST, '/functions/' . $function['body']['$id'] . '/executions', array_merge([
|
$execution = $this->client->call(Client::METHOD_POST, '/functions/' . $function['body']['$id'] . '/executions', array_merge([
|
||||||
'content-type' => 'application/json',
|
'content-type' => 'application/json',
|
||||||
'x-appwrite-project' => $this->getProject()['$id'],
|
'x-appwrite-project' => $this->getProject()['$id'],
|
||||||
|
@ -258,6 +258,17 @@ class FunctionsCustomClientTest extends Scope
|
||||||
$this->assertEquals(202, $execution['headers']['status-code']);
|
$this->assertEquals(202, $execution['headers']['status-code']);
|
||||||
$this->assertEquals('scheduled', $execution['body']['status'], \json_encode($execution['body']));
|
$this->assertEquals('scheduled', $execution['body']['status'], \json_encode($execution['body']));
|
||||||
|
|
||||||
|
$executionId = $execution['body']['$id'];
|
||||||
|
|
||||||
|
\sleep(12);
|
||||||
|
|
||||||
|
$execution = $this->client->call(Client::METHOD_GET, '/functions/' . $function['body']['$id'] . '/executions/' . $executionId, [
|
||||||
|
'content-type' => 'application/json',
|
||||||
|
'x-appwrite-project' => $this->getProject()['$id'],
|
||||||
|
'x-appwrite-key' => $this->getProject()['apiKey'],
|
||||||
|
]);
|
||||||
|
$this->assertEquals('completed', $execution['body']['status'], \json_encode($execution['body']));
|
||||||
|
|
||||||
// Cleanup : Delete function
|
// Cleanup : Delete function
|
||||||
$response = $this->client->call(Client::METHOD_DELETE, '/functions/' . $function['body']['$id'], [
|
$response = $this->client->call(Client::METHOD_DELETE, '/functions/' . $function['body']['$id'], [
|
||||||
'content-type' => 'application/json',
|
'content-type' => 'application/json',
|
||||||
|
@ -269,6 +280,7 @@ class FunctionsCustomClientTest extends Scope
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function testCreateCustomExecution(): array
|
public function testCreateCustomExecution(): array
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue