1
0
Fork 0
mirror of synced 2024-06-29 03:30:34 +12:00
appwrite/tests/e2e/Services/Health/HealthCustomServerTest.php

235 lines
6.9 KiB
PHP
Raw Normal View History

2020-01-13 04:20:51 +13:00
<?php
namespace Tests\E2E\Services\Health;
2020-05-01 22:43:31 +12:00
use Tests\E2E\Client;
2020-01-13 04:20:51 +13:00
use Tests\E2E\Scopes\Scope;
use Tests\E2E\Scopes\ProjectCustom;
use Tests\E2E\Scopes\SideClient;
2020-06-07 18:00:14 +12:00
use Tests\E2E\Scopes\SideServer;
2020-01-13 04:20:51 +13:00
2020-12-27 01:10:14 +13:00
class HealthCustomServerTest extends Scope
2020-01-13 04:20:51 +13:00
{
use HealthBase;
use ProjectCustom;
2020-06-07 18:00:14 +12:00
use SideServer;
2020-05-01 22:43:31 +12:00
2021-10-27 02:19:28 +13:00
public function testHTTPSuccess(): array
2020-05-01 22:43:31 +12:00
{
/**
* Test for SUCCESS
*/
$response = $this->client->call(Client::METHOD_GET, '/health', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), []);
$this->assertEquals(200, $response['headers']['status-code']);
2021-12-17 01:19:04 +13:00
$this->assertEquals('pass', $response['body']['status']);
$this->assertIsInt($response['body']['ping']);
$this->assertLessThan(100, $response['body']['ping']);
2020-05-01 22:43:31 +12:00
/**
* Test for FAILURE
*/
2021-10-27 02:19:28 +13:00
2020-05-01 22:43:31 +12:00
return [];
}
2021-10-27 02:19:28 +13:00
public function testDBSuccess(): array
2020-05-01 22:43:31 +12:00
{
/**
* Test for SUCCESS
*/
$response = $this->client->call(Client::METHOD_GET, '/health/db', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), []);
$this->assertEquals(200, $response['headers']['status-code']);
2021-12-17 01:19:04 +13:00
$this->assertEquals('pass', $response['body']['status']);
$this->assertIsInt($response['body']['ping']);
$this->assertLessThan(100, $response['body']['ping']);
2020-05-01 22:43:31 +12:00
/**
* Test for FAILURE
*/
2021-10-27 02:19:28 +13:00
2020-05-01 22:43:31 +12:00
return [];
}
2021-10-27 02:19:28 +13:00
public function testCacheSuccess(): array
2020-05-01 22:43:31 +12:00
{
/**
* Test for SUCCESS
*/
2020-12-27 04:10:45 +13:00
$response = $this->client->call(Client::METHOD_GET, '/health/cache', array_merge([
2020-05-01 22:43:31 +12:00
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), []);
$this->assertEquals(200, $response['headers']['status-code']);
2021-12-17 01:19:04 +13:00
$this->assertEquals('pass', $response['body']['status']);
$this->assertIsInt($response['body']['ping']);
$this->assertLessThan(100, $response['body']['ping']);
2020-05-01 22:43:31 +12:00
/**
* Test for FAILURE
*/
2021-10-27 02:19:28 +13:00
2020-05-01 22:43:31 +12:00
return [];
}
2021-10-27 02:19:28 +13:00
public function testTimeSuccess(): array
2020-05-01 22:43:31 +12:00
{
/**
* Test for SUCCESS
*/
$response = $this->client->call(Client::METHOD_GET, '/health/time', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), []);
$this->assertEquals(200, $response['headers']['status-code']);
2021-12-17 01:19:04 +13:00
$this->assertIsInt($response['body']['remoteTime']);
$this->assertIsInt($response['body']['localTime']);
$this->assertNotEmpty($response['body']['remoteTime']);
$this->assertNotEmpty($response['body']['localTime']);
2020-05-01 22:43:31 +12:00
$this->assertLessThan(10, $response['body']['diff']);
/**
* Test for FAILURE
*/
2021-10-27 02:19:28 +13:00
2020-05-01 22:43:31 +12:00
return [];
}
2021-10-27 02:19:28 +13:00
public function testWebhooksSuccess(): array
2020-05-01 22:43:31 +12:00
{
/**
* Test for SUCCESS
*/
$response = $this->client->call(Client::METHOD_GET, '/health/queue/webhooks', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), []);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertIsInt($response['body']['size']);
2020-05-02 02:02:05 +12:00
$this->assertLessThan(100, $response['body']['size']);
2020-05-01 22:43:31 +12:00
/**
* Test for FAILURE
*/
return [];
}
2021-10-27 02:19:28 +13:00
public function testLogsSuccess(): array
2020-05-01 22:43:31 +12:00
{
/**
* Test for SUCCESS
*/
$response = $this->client->call(Client::METHOD_GET, '/health/queue/logs', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), []);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertIsInt($response['body']['size']);
2020-05-02 02:02:05 +12:00
$this->assertLessThan(100, $response['body']['size']);
2020-05-01 22:43:31 +12:00
/**
* Test for FAILURE
*/
2021-10-27 02:19:28 +13:00
2020-05-01 22:43:31 +12:00
return [];
}
2021-10-27 02:19:28 +13:00
public function testUsageSuccess(): array
2020-05-01 22:43:31 +12:00
{
/**
* Test for SUCCESS
*/
$response = $this->client->call(Client::METHOD_GET, '/health/queue/usage', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), []);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertIsInt($response['body']['size']);
2022-01-03 04:19:27 +13:00
$this->assertLessThan(200, $response['body']['size']);
2020-05-01 22:43:31 +12:00
/**
* Test for FAILURE
*/
2021-10-27 02:19:28 +13:00
2020-05-01 22:43:31 +12:00
return [];
}
2021-10-27 02:19:28 +13:00
public function testCertificatesSuccess(): array
2020-05-01 22:43:31 +12:00
{
/**
* Test for SUCCESS
*/
$response = $this->client->call(Client::METHOD_GET, '/health/queue/certificates', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), []);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertIsInt($response['body']['size']);
2020-05-02 02:02:05 +12:00
$this->assertLessThan(100, $response['body']['size']);
2020-05-01 22:43:31 +12:00
/**
* Test for FAILURE
*/
2021-10-27 02:19:28 +13:00
2020-05-01 22:43:31 +12:00
return [];
}
2021-10-27 02:19:28 +13:00
public function testStorageLocalSuccess(): array
2020-05-01 22:43:31 +12:00
{
/**
* Test for SUCCESS
*/
$response = $this->client->call(Client::METHOD_GET, '/health/storage/local', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), []);
$this->assertEquals(200, $response['headers']['status-code']);
2021-12-17 01:19:04 +13:00
$this->assertEquals('pass', $response['body']['status']);
$this->assertIsInt($response['body']['ping']);
$this->assertLessThan(100, $response['body']['ping']);
2020-05-01 22:43:31 +12:00
/**
* Test for FAILURE
*/
2021-10-27 02:19:28 +13:00
2020-05-01 22:43:31 +12:00
return [];
}
2021-10-27 02:19:28 +13:00
public function testStorageAntiVirusSuccess(): array
2020-05-01 22:43:31 +12:00
{
/**
* Test for SUCCESS
*/
2020-05-19 00:34:28 +12:00
$response = $this->client->call(Client::METHOD_GET, '/health/anti-virus', array_merge([
2020-05-01 22:43:31 +12:00
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), []);
$this->assertEquals(200, $response['headers']['status-code']);
2021-03-20 21:50:30 +13:00
$this->assertNotEmpty($response['body']['status']);
$this->assertIsString($response['body']['status']);
$this->assertIsString($response['body']['version']);
2020-05-01 22:43:31 +12:00
/**
* Test for FAILURE
*/
2021-10-27 02:19:28 +13:00
2020-05-01 22:43:31 +12:00
return [];
}
2021-10-27 02:19:28 +13:00
}