1
0
Fork 0
mirror of synced 2024-09-18 18:40:24 +12:00

Fix tests

This commit is contained in:
Matej Bačo 2024-08-14 12:50:25 +00:00
parent c8e9f2e913
commit af9acf9f70
2 changed files with 12 additions and 7 deletions

View file

@ -553,6 +553,12 @@ To run end-2-end tests for a specific service use:
docker compose exec appwrite test /usr/src/code/tests/e2e/Services/[ServiceName]
```
To run one specific test:
```bash
docker compose exec appwrite vendor/bin/phpunit --filter [FunctionName]
```
## Benchmarking
You can use WRK Docker image to benchmark the server performance. Benchmarking is extremely useful when you want to compare how the server behaves before and after a change has been applied. Replace [APPWRITE_HOSTNAME_OR_IP] with your Appwrite server hostname or IP. Note that localhost is not accessible from inside the WRK container.

View file

@ -450,12 +450,11 @@ class FunctionsCustomServerTest extends Scope
], $this->getHeaders()));
$this->assertEquals(200, $template['headers']['status-code']);
$this->assertArrayHasKey('', $template['body']);
$entrypoint = null;
$rootDirectory = null;
$commands = null;
foreach($template['runtimes'] as $runtime) {
foreach($template['body']['runtimes'] as $runtime) {
if($runtime["name"] !== $runtimeName) {
continue;
}
@ -474,7 +473,7 @@ class FunctionsCustomServerTest extends Scope
* Remove bellow assertion and update test to crete variable,
* and ensure variable works as expected in execution.
*/
$this->assertEmpty($template['variables']);
$this->assertEmpty($template['body']['variables']);
// Create function using settings from template.
// Deployment is automatically created from template inside endpoint
@ -513,9 +512,9 @@ class FunctionsCustomServerTest extends Scope
$this->assertEquals(200, $deployments['headers']['status-code']);
$this->assertEquals(1, $deployments['body']['total']);
$this->assertNotEmpty($deployments['body']['deployments']['$id']);
$this->assertNotEmpty($deployments['body']['deployments'][0]['$id']);
$deploymentId = $deployments['body']['deployments']['$id'];
$deploymentId = $deployments['body']['deployments'][0]['$id'];
// Wait for deployment build to finish
// Deployment is automatically activated
@ -552,8 +551,8 @@ class FunctionsCustomServerTest extends Scope
'x-appwrite-key' => $this->getProject()['apiKey'],
], $this->getHeaders()), []);
$this->assertEquals(200, $execution['headers']['status-code']);
$this->assertIsInt($execution['body']['total']);
$this->assertEquals(200, $users['headers']['status-code']);
$this->assertIsInt($users['body']['total']);
$totalusers = $users['body']['total'];