fix(deployment): detect application configuration changes consistently

Expand configuration snapshots, handle defaults from older snapshots, and refresh configuration state after Livewire setting changes.
This commit is contained in:
Andras Bacsai committed 2026-07-14 12:54:31 +02:00
1 parent 5381287606
commit 99e255a572
16 files changed
+415 -11

No files matched your search

@@ -0,0 +1,36 @@
<?php
use App\Livewire\Project\Application\Swarm;
use App\Models\Application;
use App\Models\Environment;
use App\Models\Project;
use App\Models\Server;
use App\Models\Team;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Livewire\Livewire;
uses(RefreshDatabase::class);
it('dispatches configuration changed when Swarm settings are saved', function (string $method) {
$team = Team::factory()->create();
$user = User::factory()->create();
$team->members()->attach($user->id, ['role' => 'owner']);
$server = Server::factory()->create(['team_id' => $team->id]);
$project = Project::factory()->create(['team_id' => $team->id]);
$environment = Environment::factory()->create(['project_id' => $project->id]);
$application = Application::factory()->create([
'environment_id' => $environment->id,
'destination_id' => $server->standaloneDockers()->firstOrFail()->id,
'destination_type' => $server->standaloneDockers()->firstOrFail()->getMorphClass(),
'swarm_replicas' => 1,
]);
$this->actingAs($user);
Livewire::test(Swarm::class, ['application' => $application])
->set('isSwarmOnlyWorkerNodes', false)
->call($method)
->assertHasNoErrors()
->assertDispatched('configurationChanged');
})->with(['instantSave', 'submit']);