mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Fix failing test
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1082,7 +1082,7 @@ App::post('/v1/functions/:functionId/deployments')
|
||||
->inject('queueForBuilds')
|
||||
->action(function (string $functionId, ?string $entrypoint, ?string $commands, mixed $code, mixed $activate, Request $request, Response $response, Database $dbForProject, Event $queueForEvents, Document $project, Device $deviceForFunctions, Device $deviceForLocal, Build $queueForBuilds) {
|
||||
|
||||
$activate = !(\is_bool($activate)) ? ($activate === 'true') : $activate;
|
||||
$activate = \strval($activate === 'true') || \strval($activate) === '1';
|
||||
|
||||
$function = $dbForProject->getDocument('functions', $functionId);
|
||||
|
||||
@@ -1180,7 +1180,6 @@ App::post('/v1/functions/:functionId/deployments')
|
||||
throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed moving file');
|
||||
}
|
||||
|
||||
$activate = (bool) filter_var($activate, FILTER_VALIDATE_BOOLEAN);
|
||||
$type = $request->getHeader('x-sdk-language') === 'cli' ? 'cli' : 'manual';
|
||||
|
||||
if ($chunksUploaded === $chunks) {
|
||||
|
||||
@@ -250,8 +250,8 @@ class FunctionsCustomClientTest extends Scope
|
||||
break;
|
||||
}
|
||||
|
||||
if (\microtime(true) - $start > 5) {
|
||||
$this->fail('Execution did not complete within 5 seconds of schedule');
|
||||
if (\microtime(true) - $start > 10) {
|
||||
$this->fail('Execution did not complete within 10 seconds of schedule');
|
||||
}
|
||||
|
||||
usleep(500000); // 0.5 seconds
|
||||
|
||||
@@ -468,6 +468,39 @@ class FunctionsCustomServerTest extends Scope
|
||||
|
||||
$this->awaitDeploymentIsBuilt($data['functionId'], $deploymentId);
|
||||
|
||||
$deployment = $this->client->call(Client::METHOD_POST, '/functions/' . $data['functionId'] . '/deployments', array_merge([
|
||||
'content-type' => 'multipart/form-data',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'code' => new CURLFile($code, 'application/x-gzip', \basename($code)),
|
||||
'activate' => 'false'
|
||||
]);
|
||||
|
||||
\var_dump($deployment);
|
||||
|
||||
$this->assertEquals(202, $deployment['headers']['status-code']);
|
||||
$this->assertNotEmpty($deployment['body']['$id']);
|
||||
|
||||
$deploymentIdInactive = $deployment['body']['$id'] ?? '';
|
||||
|
||||
$this->awaitDeploymentIsBuilt($data['functionId'], $deploymentIdInactive);
|
||||
|
||||
$function = $this->client->call(Client::METHOD_GET, '/functions/' . $data['functionId'], array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()));
|
||||
|
||||
$this->assertEquals(200, $function['headers']['status-code']);
|
||||
$this->assertEquals($deploymentId, $function['body']['deployment']);
|
||||
$this->assertNotEquals($deploymentIdInactive, $function['body']['deployment']);
|
||||
|
||||
$deployment = $this->client->call(Client::METHOD_DELETE, '/functions/' . $data['functionId'] . '/deployments/' . $deploymentIdInactive, array_merge([
|
||||
'content-type' => 'multipart/form-data',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), []);
|
||||
|
||||
$this->assertEquals(204, $deployment['headers']['status-code']);
|
||||
|
||||
return array_merge($data, ['deploymentId' => $deploymentId]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user