wowowowowo
Some checks failed
CI / Lint (push) Failing after 22s
CI / Tests (push) Failing after 33s

This commit is contained in:
2026-05-28 15:15:41 +01:00
parent 8f603122e2
commit 5b977c1f41
129 changed files with 9943 additions and 722 deletions

View File

@@ -1,6 +1,9 @@
<?php
use App\Enums\RegistryType;
use App\Models\Application;
use App\Models\BuildArtifact;
use App\Models\Environment;
use App\Models\Organisation;
use App\Models\User;
use Inertia\Testing\AssertableInertia;
@@ -19,6 +22,25 @@ it('shows the create registry page', function () {
->where('registryTypes.0', RegistryType::GENERIC->value));
});
it('lists registries for an organisation', function () {
$user = User::factory()->create();
$organisation = Organisation::factory()->create(['owner_id' => $user->id]);
$organisation->registries()->create([
'name' => 'GHCR',
'type' => RegistryType::GHCR,
'url' => 'ghcr.io/example',
'credentials' => ['username' => 'keystone', 'password' => 'secret'],
]);
$this->actingAs($user)
->get(route('registries.index', $organisation))
->assertOk()
->assertInertia(fn (AssertableInertia $page) => $page
->component('registries/Index', false)
->has('registries', 1)
->where('registries.0.name', 'GHCR'));
});
it('stores a registry for multi-server build artifacts', function () {
$user = User::factory()->create();
$organisation = Organisation::factory()->create(['owner_id' => $user->id]);
@@ -47,3 +69,33 @@ it('stores a registry for multi-server build artifacts', function () {
'password' => 'secret',
]);
});
it('shows registry usage from published build artifacts', function () {
$user = User::factory()->create();
$organisation = Organisation::factory()->create(['owner_id' => $user->id]);
$registry = $organisation->registries()->create([
'name' => 'GHCR',
'type' => RegistryType::GHCR,
'url' => 'ghcr.io/example',
'credentials' => ['username' => 'keystone', 'password' => 'secret'],
]);
$application = Application::factory()->for($organisation)->create();
$environment = Environment::factory()->for($application)->create();
BuildArtifact::query()->create([
'environment_id' => $environment->id,
'commit_sha' => 'abc123',
'image_tag' => 'app:abc123',
'registry_ref' => 'ghcr.io/example/app:abc123',
]);
$this->actingAs($user)
->get(route('registries.show', [$organisation, $registry]))
->assertOk()
->assertInertia(fn (AssertableInertia $page) => $page
->component('registries/Show', false)
->where('registry.id', $registry->id)
->where('artifactCount', 1)
->where('environmentCount', 1)
->has('artifacts.data', 1));
});