Skip to content

Commit e860a21

Browse files
Cover namespace-scoped worker fleet metrics in dashboard stats
Cover namespace-scoped worker fleet metrics in dashboard stats
1 parent 7cc01cb commit e860a21

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

tests/Feature/V2DashboardStatsControllerTest.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,42 @@ public function testIndexCountsOnlyActualFailuresForWeeklyFailedTotals(): void
150150
->assertJsonPath('failed_flows_past_week', 0);
151151
}
152152

153+
public function testIndexScopesWorkerFleetToConfiguredWaterlineNamespace(): void
154+
{
155+
config()->set('waterline.engine_source', 'v2');
156+
config()->set('waterline.namespace', 'billing');
157+
config()->set('workflows.v2.compatibility.current', 'build-a');
158+
config()->set('workflows.v2.compatibility.namespace', 'shipping');
159+
160+
WorkerCompatibilityFleet::clear();
161+
$this->beforeApplicationDestroyed(static function (): void {
162+
WorkerCompatibilityFleet::clear();
163+
});
164+
165+
WorkerCompatibilityFleet::recordForNamespace(
166+
namespace: 'billing',
167+
supported: ['build-a'],
168+
connection: 'redis',
169+
queue: 'default',
170+
workerId: 'worker-billing',
171+
);
172+
WorkerCompatibilityFleet::recordForNamespace(
173+
namespace: 'shipping',
174+
supported: ['build-a'],
175+
connection: 'redis',
176+
queue: 'default',
177+
workerId: 'worker-shipping',
178+
);
179+
180+
$this->get('/waterline/api/stats')
181+
->assertOk()
182+
->assertJsonPath('operator_metrics.workers.compatibility_namespace', 'billing')
183+
->assertJsonPath('operator_metrics.workers.active_workers', 1)
184+
->assertJsonPath('operator_metrics.workers.active_worker_scopes', 1)
185+
->assertJsonPath('operator_metrics.workers.fleet.0.worker_id', 'worker-billing')
186+
->assertJsonPath('operator_metrics.workers.fleet.0.namespace', 'billing');
187+
}
188+
153189
public function testIndexIncludesV2OperatorMetrics(): void
154190
{
155191
config()->set('waterline.engine_source', 'v2');

0 commit comments

Comments
 (0)