mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-04 07:22:34 +00:00
#591 - tests
This commit is contained in:
@ -21,7 +21,9 @@ public function test_install_vito_agent(): void
|
||||
'https://api.github.com/repos/vitodeploy/agent/tags' => Http::response([['name' => '0.1.0']]),
|
||||
]);
|
||||
|
||||
$service = app(Install::class)->install($this->server, [
|
||||
$this->server->monitoring()->delete();
|
||||
|
||||
app(Install::class)->install($this->server, [
|
||||
'type' => 'monitoring',
|
||||
'name' => 'vito-agent',
|
||||
'version' => 'latest',
|
||||
@ -34,12 +36,11 @@ public function test_install_vito_agent(): void
|
||||
'version' => '0.1.0',
|
||||
'status' => ServiceStatus::READY,
|
||||
]);
|
||||
|
||||
$this->assertNotNull($service->type_data);
|
||||
}
|
||||
|
||||
public function test_install_vito_agent_failed(): void
|
||||
{
|
||||
$this->server->monitoring()->delete();
|
||||
$this->expectExceptionMessage('Failed to fetch tags');
|
||||
SSH::fake('Active: inactive');
|
||||
Http::fake([
|
||||
@ -58,7 +59,7 @@ public function test_install_nginx(): void
|
||||
|
||||
SSH::fake('Active: active');
|
||||
|
||||
$service = app(Install::class)->install($this->server, [
|
||||
app(Install::class)->install($this->server, [
|
||||
'type' => 'webserver',
|
||||
'name' => 'nginx',
|
||||
'version' => 'latest',
|
||||
@ -71,8 +72,6 @@ public function test_install_nginx(): void
|
||||
'version' => 'latest',
|
||||
'status' => ServiceStatus::READY,
|
||||
]);
|
||||
|
||||
$this->assertNotNull($service->type_data);
|
||||
}
|
||||
|
||||
public function test_install_caddy(): void
|
||||
@ -81,7 +80,7 @@ public function test_install_caddy(): void
|
||||
|
||||
SSH::fake('Active: active');
|
||||
|
||||
$service = app(Install::class)->install($this->server, [
|
||||
app(Install::class)->install($this->server, [
|
||||
'type' => 'webserver',
|
||||
'name' => 'caddy',
|
||||
'version' => 'latest',
|
||||
@ -94,8 +93,6 @@ public function test_install_caddy(): void
|
||||
'version' => 'latest',
|
||||
'status' => ServiceStatus::READY,
|
||||
]);
|
||||
|
||||
$this->assertNotNull($service->type_data);
|
||||
}
|
||||
|
||||
public function test_install_mysql(): void
|
||||
@ -104,7 +101,7 @@ public function test_install_mysql(): void
|
||||
|
||||
SSH::fake('Active: active');
|
||||
|
||||
$service = app(Install::class)->install($this->server, [
|
||||
app(Install::class)->install($this->server, [
|
||||
'type' => 'database',
|
||||
'name' => 'mysql',
|
||||
'version' => '8.0',
|
||||
@ -117,8 +114,6 @@ public function test_install_mysql(): void
|
||||
'version' => '8.0',
|
||||
'status' => ServiceStatus::READY,
|
||||
]);
|
||||
|
||||
$this->assertNotNull($service->type_data);
|
||||
}
|
||||
|
||||
public function test_install_mysql_failed(): void
|
||||
@ -137,7 +132,7 @@ public function test_install_supervisor(): void
|
||||
|
||||
SSH::fake('Active: active');
|
||||
|
||||
$service = app(Install::class)->install($this->server, [
|
||||
app(Install::class)->install($this->server, [
|
||||
'type' => 'process_manager',
|
||||
'name' => 'supervisor',
|
||||
'version' => 'latest',
|
||||
@ -150,8 +145,6 @@ public function test_install_supervisor(): void
|
||||
'version' => 'latest',
|
||||
'status' => ServiceStatus::READY,
|
||||
]);
|
||||
|
||||
$this->assertNotNull($service->type_data);
|
||||
}
|
||||
|
||||
public function test_install_redis(): void
|
||||
@ -160,7 +153,7 @@ public function test_install_redis(): void
|
||||
|
||||
SSH::fake('Active: active');
|
||||
|
||||
$service = app(Install::class)->install($this->server, [
|
||||
app(Install::class)->install($this->server, [
|
||||
'type' => 'memory_database',
|
||||
'name' => 'redis',
|
||||
'version' => 'latest',
|
||||
@ -173,7 +166,5 @@ public function test_install_redis(): void
|
||||
'version' => 'latest',
|
||||
'status' => ServiceStatus::READY,
|
||||
]);
|
||||
|
||||
$this->assertNotNull($service->type_data);
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,9 @@ public function test_uninstall_vito_agent(): void
|
||||
{
|
||||
SSH::fake();
|
||||
|
||||
Service::factory()->create([
|
||||
$this->server->monitoring()->delete();
|
||||
|
||||
$service = Service::factory()->create([
|
||||
'server_id' => $this->server->id,
|
||||
'name' => 'vito-agent',
|
||||
'type' => 'monitoring',
|
||||
@ -31,11 +33,7 @@ public function test_uninstall_vito_agent(): void
|
||||
app(Uninstall::class)->uninstall($this->server->monitoring());
|
||||
|
||||
$this->assertDatabaseMissing('services', [
|
||||
'server_id' => $this->server->id,
|
||||
'name' => 'vito-agent',
|
||||
'type' => 'monitoring',
|
||||
'version' => 'latest',
|
||||
'status' => ServiceStatus::READY,
|
||||
'id' => $service->id,
|
||||
]);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user