Add managed registry provisioning, pruning, and readiness tracking
This commit is contained in:
@@ -99,6 +99,8 @@ it('runs an environment deployment from the application surface', function () {
|
||||
});
|
||||
|
||||
it('blocks multi-server environment deployment until a registry is configured', function () {
|
||||
config(['keystone.managed_registry.url' => null]);
|
||||
|
||||
$user = User::factory()->create();
|
||||
$organisation = Organisation::factory()->create(['owner_id' => $user->id]);
|
||||
$provider = Provider::factory()->forOrganisation($organisation)->create();
|
||||
@@ -152,6 +154,64 @@ it('blocks multi-server environment deployment until a registry is configured',
|
||||
Bus::assertDispatched(DeployEnvironment::class);
|
||||
});
|
||||
|
||||
it('dispatches multi-server environment deployments when a managed registry exists', function () {
|
||||
$user = User::factory()->create();
|
||||
$organisation = Organisation::factory()->create(['owner_id' => $user->id]);
|
||||
$provider = Provider::factory()->forOrganisation($organisation)->create();
|
||||
$network = Network::create([
|
||||
'organisation_id' => $organisation->id,
|
||||
'provider_id' => $provider->id,
|
||||
'name' => 'test-network',
|
||||
'ip_range' => '10.0.0.0/24',
|
||||
]);
|
||||
$primaryServer = Server::factory()
|
||||
->forOrganisation($organisation->id)
|
||||
->forProvider($provider->id)
|
||||
->forNetwork($network->id)
|
||||
->create([
|
||||
'is_control_node' => true,
|
||||
'build_enabled' => true,
|
||||
]);
|
||||
$organisation->registries()->create([
|
||||
'name' => 'Managed',
|
||||
'type' => RegistryType::MANAGED,
|
||||
'url' => 'registry.example.com',
|
||||
'credentials' => [
|
||||
'build_username' => 'keystone-build',
|
||||
'build_password' => 'secret',
|
||||
'runtime_username' => 'keystone-runtime',
|
||||
'runtime_password' => 'runtime-secret',
|
||||
],
|
||||
'control_server_id' => $primaryServer->id,
|
||||
'health_status' => 'healthy',
|
||||
'readiness_checks' => ['control_https' => 'passed', 'build_push' => 'passed'],
|
||||
'ready_at' => now(),
|
||||
]);
|
||||
$secondaryServer = Server::factory()
|
||||
->forOrganisation($organisation->id)
|
||||
->forProvider($provider->id)
|
||||
->forNetwork($network->id)
|
||||
->create();
|
||||
$application = Application::factory()->for($organisation)->create();
|
||||
$environment = Environment::factory()->for($application)->create();
|
||||
$service = Service::factory()->for($environment)->for($primaryServer)->create([
|
||||
'organisation_id' => $organisation->id,
|
||||
'category' => ServiceCategory::APPLICATION,
|
||||
'deploy_policy' => DeployPolicy::WITH_ENVIRONMENT,
|
||||
]);
|
||||
ServiceReplica::factory()
|
||||
->for($service)
|
||||
->for($secondaryServer, 'server')
|
||||
->create();
|
||||
Bus::fake();
|
||||
|
||||
$this->actingAs($user)
|
||||
->post(route('environment-deployments.store', [$organisation, $application, $environment]))
|
||||
->assertRedirect(route('environments.show', [$organisation, $application, $environment]));
|
||||
|
||||
Bus::assertDispatched(DeployEnvironment::class);
|
||||
});
|
||||
|
||||
it('deploys an environment at a specific commit when provided', function () {
|
||||
$user = User::factory()->create();
|
||||
$organisation = Organisation::factory()->create(['owner_id' => $user->id]);
|
||||
|
||||
Reference in New Issue
Block a user