feat: update test message
This commit is contained in:
parent
ee056e582f
commit
13b28e0051
|
@ -960,7 +960,7 @@ App::post('/v1/functions/:functionId/executions')
|
|||
$execution->setAttribute('stderr', $executionResponse['stderr']);
|
||||
$execution->setAttribute('time', $executionResponse['time']);
|
||||
} catch (\Throwable $th) {
|
||||
$endtime = \time();
|
||||
$endtime = \microtime(true);
|
||||
$time = $endtime - $execution->getAttribute('dateCreated');
|
||||
$execution->setAttribute('time', $time);
|
||||
$execution->setAttribute('status', 'failed');
|
||||
|
|
|
@ -457,7 +457,8 @@ App::post('/v1/execution')
|
|||
|
||||
switch (true) {
|
||||
/** No Error. */
|
||||
case $errNo === 0: break;
|
||||
case $errNo === 0:
|
||||
break;
|
||||
/** Runtime not ready for requests yet. 111 is the swoole error code for Connection Refused - see https://openswoole.com/docs/swoole-error-code */
|
||||
case $errNo === 111:
|
||||
throw new Exception('An internal curl error has occurred within the executor! Error Msg: ' . $error, 406);
|
||||
|
|
|
@ -287,6 +287,7 @@ class FunctionsV1 extends Worker
|
|||
$vars = \array_merge($function->getAttribute('vars', []), $vars);
|
||||
|
||||
/** Execute function */
|
||||
$startTime = microtime(true);
|
||||
try {
|
||||
$executionResponse = $this->executor->createExecution(
|
||||
projectId: $projectId,
|
||||
|
@ -307,7 +308,7 @@ class FunctionsV1 extends Worker
|
|||
$execution->setAttribute('stderr', $executionResponse['stderr']);
|
||||
$execution->setAttribute('time', $executionResponse['time']);
|
||||
} catch (\Throwable $th) {
|
||||
$endtime = \time();
|
||||
$endtime = \microtime(true);
|
||||
$time = $endtime - $execution->getAttribute('dateCreated');
|
||||
$execution->setAttribute('time', $time);
|
||||
$execution->setAttribute('status', 'failed');
|
||||
|
|
|
@ -161,12 +161,14 @@ class Executor
|
|||
'timeout' => $timeout,
|
||||
];
|
||||
|
||||
/* Add 2 seconds as a buffer to the actual timeout value since there can be a slight variance*/
|
||||
$requestTimeout = $timeout + 2;
|
||||
/* Add 1 second as a buffer to the actual timeout value since there can be a slight variance*/
|
||||
$requestTimeout = $timeout + 1;
|
||||
|
||||
$response = $this->call(self::METHOD_POST, $route, $headers, $params, true, $requestTimeout);
|
||||
$status = $response['headers']['status-code'];
|
||||
|
||||
var_dump($response);
|
||||
var_dump($status);
|
||||
for ($attempts = 0; $attempts < 10; $attempts++) {
|
||||
try {
|
||||
switch (true) {
|
||||
|
|
|
@ -763,9 +763,9 @@ class FunctionsCustomServerTest extends Scope
|
|||
$this->assertEquals($executions['body']['executions'][0]['status'], 'failed');
|
||||
$this->assertEquals($executions['body']['executions'][0]['statusCode'], 500);
|
||||
$this->assertGreaterThan(2, $executions['body']['executions'][0]['time']);
|
||||
$this->assertLessThan(3, $executions['body']['executions'][0]['time']);
|
||||
$this->assertLessThan(6, $executions['body']['executions'][0]['time']);
|
||||
$this->assertEquals($executions['body']['executions'][0]['stdout'], '');
|
||||
$this->assertEquals($executions['body']['executions'][0]['stderr'], 'Execution timed out.');
|
||||
$this->assertEquals($executions['body']['executions'][0]['stderr'], 'An internal curl error has occurred within the executor! Error Msg: Operation timed out');
|
||||
|
||||
// Cleanup : Delete function
|
||||
$response = $this->client->call(Client::METHOD_DELETE, '/functions/'. $functionId, [
|
||||
|
|
Loading…
Reference in a new issue