diff --git a/src/Executor/Executor.php b/src/Executor/Executor.php index 34cdae38d2..29ed756932 100644 --- a/src/Executor/Executor.php +++ b/src/Executor/Executor.php @@ -225,8 +225,8 @@ class Executor $response['body']['headers'] = \json_decode($response['body']['headers'] ?? '{}', true); $response['body']['statusCode'] = \intval($response['body']['statusCode'] ?? 500); - $response['body']['duration'] = \intval($response['body']['duration'] ?? 0); - $response['body']['startTime'] = \intval($response['body']['startTime'] ?? \microtime(true)); + $response['body']['duration'] = \floatval($response['body']['duration'] ?? 0); + $response['body']['startTime'] = \floatval($response['body']['startTime'] ?? \microtime(true)); return $response['body']; } diff --git a/tests/e2e/Services/Functions/FunctionsCustomClientTest.php b/tests/e2e/Services/Functions/FunctionsCustomClientTest.php index 9a42d54434..bf969d388a 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomClientTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomClientTest.php @@ -182,6 +182,7 @@ class FunctionsCustomClientTest extends Scope $this->assertEquals($executions['body']['executions'][1]['responseStatusCode'], 200); $this->assertEquals($executions['body']['executions'][1]['responseBody'], ''); $this->assertEquals($executions['body']['executions'][1]['logs'], ''); + $this->assertGreaterThan(0, $executions['body']['executions'][1]['duration']); // Cleanup : Delete function $response = $this->client->call(Client::METHOD_DELETE, '/functions/' . $function['body']['$id'], [ @@ -301,6 +302,7 @@ class FunctionsCustomClientTest extends Scope $this->assertEquals('completed', $execution['body']['status']); $this->assertEquals('/custom', $execution['body']['requestPath']); $this->assertEquals('GET', $execution['body']['requestMethod']); + $this->assertGreaterThan(0, $execution['body']['duration']); /* Test for FAILURE */ @@ -438,6 +440,7 @@ class FunctionsCustomClientTest extends Scope $output = json_decode($execution['body']['responseBody'], true); $this->assertEquals(201, $execution['headers']['status-code']); $this->assertEquals(200, $execution['body']['responseStatusCode']); + $this->assertGreaterThan(0, $execution['body']['duration']); $this->assertEquals('completed', $execution['body']['status']); $this->assertEquals($functionId, $output['APPWRITE_FUNCTION_ID']); $this->assertEquals('Test', $output['APPWRITE_FUNCTION_NAME']); diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 00ba91aec9..c9f9e4443f 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -1693,6 +1693,7 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals('completed', $execution['body']['status']); $this->assertEquals(200, $execution['body']['responseStatusCode']); $this->assertNotEmpty($execution['body']['responseBody']); + $this->assertGreaterThan(0, $execution['body']['duration']); // Cleanup : Delete function $response = $this->client->call(Client::METHOD_DELETE, '/functions/' . $functionId, [ @@ -1781,6 +1782,7 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals('completed', $execution['body']['status']); $this->assertEquals(200, $execution['body']['responseStatusCode']); $this->assertEquals($cookie, $execution['body']['responseBody']); + $this->assertGreaterThan(0, $execution['body']['duration']); // Cleanup : Delete function $response = $this->client->call(Client::METHOD_DELETE, '/functions/' . $functionId, [