1
0
Fork 0
mirror of synced 2024-07-06 07:00:56 +12:00
appwrite/tests/unit/Docker/ComposeTest.php

52 lines
1.7 KiB
PHP
Raw Normal View History

2020-07-30 03:26:01 +12:00
<?php
2022-08-01 22:22:04 +12:00
namespace Tests\Unit\Docker;
2020-07-30 03:26:01 +12:00
use Appwrite\Docker\Compose;
use Exception;
use PHPUnit\Framework\TestCase;
class ComposeTest extends TestCase
{
2022-08-01 22:22:04 +12:00
protected ?Compose $object = null;
2020-07-30 03:26:01 +12:00
2020-10-01 10:51:38 +13:00
public function setUp(): void
2020-07-30 03:26:01 +12:00
{
2022-05-24 02:54:50 +12:00
$data = @file_get_contents(__DIR__ . '/../../resources/docker/docker-compose.yml');
2020-07-30 03:26:01 +12:00
2020-10-28 08:48:38 +13:00
if ($data === false) {
2020-07-30 03:26:01 +12:00
throw new Exception('Failed to read compose file');
}
$this->object = new Compose($data);
}
2022-08-01 22:22:04 +12:00
public function testVersion(): void
2020-07-30 03:26:01 +12:00
{
$this->assertEquals('3', $this->object->getVersion());
}
2022-08-01 22:22:04 +12:00
public function testServices(): void
2020-07-30 03:26:01 +12:00
{
2022-02-01 12:44:55 +13:00
$this->assertCount(17, $this->object->getServices());
2020-07-30 03:26:01 +12:00
$this->assertEquals('appwrite-telegraf', $this->object->getService('telegraf')->getContainerName());
$this->assertEquals('appwrite', $this->object->getService('appwrite')->getContainerName());
2020-07-31 18:31:29 +12:00
$this->assertEquals('', $this->object->getService('appwrite')->getImageVersion());
$this->assertEquals('2.2', $this->object->getService('traefik')->getImageVersion());
2020-08-01 00:50:39 +12:00
$this->assertEquals(['2080' => '80', '2443' => '443', '8080' => '8080'], $this->object->getService('traefik')->getPorts());
2020-07-30 03:26:01 +12:00
}
2022-08-01 22:22:04 +12:00
public function testNetworks(): void
2020-07-30 03:26:01 +12:00
{
$this->assertCount(2, $this->object->getNetworks());
}
2022-08-01 22:22:04 +12:00
public function testVolumes(): void
2020-07-30 03:26:01 +12:00
{
$this->assertCount(9, $this->object->getVolumes());
$this->assertEquals('appwrite-mariadb', $this->object->getVolumes()[0]);
$this->assertEquals('appwrite-redis', $this->object->getVolumes()[1]);
$this->assertEquals('appwrite-cache', $this->object->getVolumes()[2]);
}
2020-10-01 10:51:38 +13:00
}