wowowowowo
This commit is contained in:
@@ -370,6 +370,70 @@ test('show service page renders inertia view', function () {
|
||||
->component('services/Show', false));
|
||||
});
|
||||
|
||||
test('show environment service page renders serverless service details', function () {
|
||||
$setup = setupTestEnvironment();
|
||||
actingAs($setup['user']);
|
||||
|
||||
$application = \App\Models\Application::factory()->create([
|
||||
'organisation_id' => $setup['organisation']->id,
|
||||
]);
|
||||
$environment = \App\Models\Environment::factory()->create([
|
||||
'application_id' => $application->id,
|
||||
]);
|
||||
$service = Service::factory()->create([
|
||||
'environment_id' => $environment->id,
|
||||
'organisation_id' => $setup['organisation']->id,
|
||||
'server_id' => null,
|
||||
'name' => 'scheduler',
|
||||
]);
|
||||
|
||||
$response = $this->get(route('environment-services.show', [
|
||||
'organisation' => $setup['organisation']->id,
|
||||
'application' => $application->id,
|
||||
'environment' => $environment->id,
|
||||
'service' => $service->id,
|
||||
]));
|
||||
|
||||
$response->assertOk();
|
||||
$response->assertInertia(fn (AssertableInertia $page) => $page
|
||||
->component('services/Show', false)
|
||||
->where('server', null)
|
||||
->where('service.id', $service->id)
|
||||
->where('service.name', 'scheduler')
|
||||
->where('environment.id', $environment->id)
|
||||
->where('application.id', $application->id));
|
||||
});
|
||||
|
||||
test('environment service page scopes service to environment', function () {
|
||||
$setup = setupTestEnvironment();
|
||||
actingAs($setup['user']);
|
||||
|
||||
$application = \App\Models\Application::factory()->create([
|
||||
'organisation_id' => $setup['organisation']->id,
|
||||
]);
|
||||
$environment = \App\Models\Environment::factory()->create([
|
||||
'application_id' => $application->id,
|
||||
]);
|
||||
$otherEnvironment = \App\Models\Environment::factory()->create([
|
||||
'application_id' => $application->id,
|
||||
'name' => 'staging',
|
||||
]);
|
||||
$service = Service::factory()->create([
|
||||
'environment_id' => $otherEnvironment->id,
|
||||
'organisation_id' => $setup['organisation']->id,
|
||||
'server_id' => null,
|
||||
]);
|
||||
|
||||
$response = $this->get(route('environment-services.show', [
|
||||
'organisation' => $setup['organisation']->id,
|
||||
'application' => $application->id,
|
||||
'environment' => $environment->id,
|
||||
'service' => $service->id,
|
||||
]));
|
||||
|
||||
$response->assertNotFound();
|
||||
});
|
||||
|
||||
test('edit service page renders inertia view', function () {
|
||||
$setup = setupTestEnvironment();
|
||||
actingAs($setup['user']);
|
||||
@@ -410,6 +474,8 @@ test('update service persists changes and redirects', function () {
|
||||
'desired_replicas' => 4,
|
||||
'default_cpu_limit' => 2,
|
||||
'default_memory_limit_mb' => 1024,
|
||||
'backup_enabled' => true,
|
||||
'backup_command' => 'pg_dump app > /home/keystone/backups/pre-update.sql',
|
||||
]);
|
||||
|
||||
$response->assertRedirect(route('services.show', [
|
||||
@@ -422,4 +488,8 @@ test('update service persists changes and redirects', function () {
|
||||
$service->refresh();
|
||||
expect($service->name)->toBe('web-renamed');
|
||||
expect($service->desired_replicas)->toBe(4);
|
||||
expect($service->config)->toMatchArray([
|
||||
'backup_enabled' => true,
|
||||
'backup_command' => 'pg_dump app > /home/keystone/backups/pre-update.sql',
|
||||
]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user