1
0
Fork 0
mirror of synced 2024-07-03 05:31:38 +12:00
appwrite/tests/e2e/ConsoleHealthTest.php

92 lines
3.1 KiB
PHP
Raw Normal View History

2019-09-20 20:57:52 +12:00
<?php
namespace Tests\E2E;
use Tests\E2E\Client;
class ConsoleHealthTest extends BaseConsole
{
2019-11-04 08:05:26 +13:00
public function testHTTPSuccess(): void
2019-09-20 20:57:52 +12:00
{
$response = $this->client->call(Client::METHOD_GET, '/health', [
'origin' => 'http://localhost',
'content-type' => 'application/json',
], []);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals('OK', $response['body']['status']);
}
2019-11-04 08:05:26 +13:00
public function testDBSuccess(): void
2019-09-20 20:57:52 +12:00
{
$response = $this->client->call(Client::METHOD_GET, '/health/db', [
'origin' => 'http://localhost',
'content-type' => 'application/json',
], []);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals('OK', $response['body']['status']);
}
2019-11-04 08:05:26 +13:00
public function testCacheSuccess(): void
2019-09-20 20:57:52 +12:00
{
$response = $this->client->call(Client::METHOD_GET, '/health/db', [
'origin' => 'http://localhost',
'content-type' => 'application/json',
], []);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals('OK', $response['body']['status']);
}
2019-11-04 08:05:26 +13:00
public function testTimeSuccess(): void
2019-09-20 20:57:52 +12:00
{
$response = $this->client->call(Client::METHOD_GET, '/health/time', [
'origin' => 'http://localhost',
'content-type' => 'application/json',
], []);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertIsInt($response['body']['remote']);
$this->assertIsInt($response['body']['local']);
$this->assertNotEmpty($response['body']['remote']);
$this->assertNotEmpty($response['body']['local']);
2019-09-28 01:30:58 +12:00
$this->assertLessThan(10, $response['body']['diff']);
2019-09-20 20:57:52 +12:00
}
2019-11-04 08:05:26 +13:00
public function testWebhooksSuccess(): void
2019-09-20 20:57:52 +12:00
{
$response = $this->client->call(Client::METHOD_GET, '/health/webhooks', [
'origin' => 'http://localhost',
'content-type' => 'application/json',
], []);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertIsInt($response['body']['size']);
$this->assertLessThan(10, $response['body']['size']);
}
2019-11-04 08:05:26 +13:00
public function xtestStorageLocalSuccess(): void
2019-09-20 20:57:52 +12:00
{
$response = $this->client->call(Client::METHOD_GET, '/health/storage/local', [
'origin' => 'http://localhost',
'content-type' => 'application/json',
], []);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals('OK', $response['body']['status']);
}
2019-11-04 08:05:26 +13:00
public function testStorageAntiVirusSuccess(): void
2019-09-20 20:57:52 +12:00
{
$response = $this->client->call(Client::METHOD_GET, '/health/storage/anti-virus', [
'origin' => 'http://localhost',
'content-type' => 'application/json',
], []);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals('online', $response['body']['status']);
$this->assertStringStartsWith('ClamAV ', $response['body']['version']);
}
}