From 70ca8c0a97cae4969a830db0055bb5ef87c6ed40 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Wed, 5 Aug 2026 17:13:17 +0100 Subject: [PATCH 1/2] Add affected components to demo schedules --- database/seeders/DatabaseSeeder.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 1161e2b6..ec658258 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -58,7 +58,7 @@ public function run(): void ]); /** @phpstan-ignore-next-line argument.type */ - tap(Schedule::create([ + $documentationMaintenance = tap(Schedule::create([ 'name' => 'Documentation Maintenance', 'message' => 'We will be conducting maintenance on our documentation servers. You may experience degraded performance during this time.', 'scheduled_at' => now()->addHours(24), @@ -79,7 +79,7 @@ public function run(): void }); /** @phpstan-ignore-next-line argument.type */ - tap(Schedule::create([ + $databaseUpgrade = tap(Schedule::create([ 'name' => 'Database Server Upgrade', 'message' => 'We upgraded our primary database servers to improve performance and reliability.', 'scheduled_at' => now()->subHours(26), @@ -138,6 +138,14 @@ public function run(): void 'checked' => true, ]); + $documentationMaintenance->components()->attach($documentation, [ + 'component_status' => ComponentStatusEnum::performance_issues, + ]); + + $databaseUpgrade->components()->attach($website, [ + 'component_status' => ComponentStatusEnum::partial_outage, + ]); + $metric = Metric::create([ 'name' => DemoMetricSeeder::METRIC_NAME, 'suffix' => 'req/s', From f75e9331ca1ce6a0db3f20e9fa2b4391a234a52a Mon Sep 17 00:00:00 2001 From: James Brooks Date: Wed, 5 Aug 2026 17:13:24 +0100 Subject: [PATCH 2/2] Test demo schedule components --- tests/Unit/Database/DatabaseSeederTest.php | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tests/Unit/Database/DatabaseSeederTest.php diff --git a/tests/Unit/Database/DatabaseSeederTest.php b/tests/Unit/Database/DatabaseSeederTest.php new file mode 100644 index 00000000..db5be9a4 --- /dev/null +++ b/tests/Unit/Database/DatabaseSeederTest.php @@ -0,0 +1,27 @@ +seed(DatabaseSeeder::class); + + $documentationMaintenance = Schedule::query() + ->where('name', 'Documentation Maintenance') + ->firstOrFail(); + $databaseUpgrade = Schedule::query() + ->where('name', 'Database Server Upgrade') + ->firstOrFail(); + + expect($documentationMaintenance->components) + ->toHaveCount(1) + ->first()->name->toBe('Cachet Documentation') + ->and($documentationMaintenance->components->first()->pivot->component_status) + ->toBe(ComponentStatusEnum::performance_issues) + ->and($databaseUpgrade->components) + ->toHaveCount(1) + ->first()->name->toBe('Cachet Website') + ->and($databaseUpgrade->components->first()->pivot->component_status) + ->toBe(ComponentStatusEnum::partial_outage); +});