team = Team::factory()->create(); $this->user = User::factory()->create(); $this->team->members()->attach($this->user->id, ['role' => 'owner']); $this->actingAs($this->user); session(['currentTeam' => $this->team]); }); dataset('ssl-aware-database-general-components', [ MysqlGeneral::class, MariadbGeneral::class, MongodbGeneral::class, RedisGeneral::class, PostgresqlGeneral::class, KeydbGeneral::class, DragonflyGeneral::class, ]); it('maps database status broadcasts to refresh for ssl-aware database general components', function (string $componentClass) { $component = app($componentClass); $listeners = $component->getListeners(); expect($listeners["echo-private:user.{$this->user->id},DatabaseStatusChanged"])->toBe('refresh') ->and($listeners["echo-private:team.{$this->team->id},ServiceChecked"])->toBe('refresh'); })->with('ssl-aware-database-general-components'); it('reloads the mysql database model when refreshing so ssl controls follow the latest status', function () { $server = Server::factory()->create(['team_id' => $this->team->id]); $destination = StandaloneDocker::where('server_id', $server->id)->first(); $project = Project::factory()->create(['team_id' => $this->team->id]); $environment = Environment::factory()->create(['project_id' => $project->id]); $database = StandaloneMysql::forceCreate([ 'name' => 'test-mysql', 'image' => 'mysql:8', 'mysql_root_password' => 'password', 'mysql_user' => 'coolify', 'mysql_password' => 'password', 'mysql_database' => 'coolify', 'status' => 'exited:unhealthy', 'enable_ssl' => true, 'is_log_drain_enabled' => false, 'environment_id' => $environment->id, 'destination_id' => $destination->id, 'destination_type' => $destination->getMorphClass(), ]); $component = Livewire::test(MysqlGeneral::class, ['database' => $database]) ->assertDontSee('Database should be stopped to change this settings.'); $database->forceFill(['status' => 'running:healthy'])->save(); $component->call('refresh') ->assertSee('Database should be stopped to change this settings.'); });