Skip to content

Commit a620346

Browse files
fix(tests): add Redis availability check to performance tests
Performance benchmark tests were attempting to connect to Redis even when REDIS_AVAILABLE environment variable was not set. Problem: - Tests had @group redis annotation for CI exclusion - No runtime check prevented Redis connection attempts - Running `vendor/bin/pest` locally without Redis caused 6 failures - Tests: 6 failed, 3 skipped, 118 passed → connection refused errors Solution: - Add beforeEach() hook to check REDIS_AVAILABLE env var - Skip all 6 performance tests when Redis is not available - Matches pattern used in EventListenersTest Result: - Tests: 9 skipped, 118 passed (0 failed) ✅ - No Redis connection errors when running locally - Performance tests properly skip: "Requires Redis - run with redis group" - CI remains unchanged (already excludes redis group)
1 parent 4d552d4 commit a620346

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/Performance/BaselineCalculationBenchmarkTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
* Performance benchmark tests for critical operations.
1111
* These tests ensure performance doesn't regress.
1212
*/
13+
beforeEach(function () {
14+
if (! getenv('REDIS_AVAILABLE')) {
15+
$this->markTestSkipped('Requires Redis - run with redis group');
16+
}
17+
});
18+
1319
test('baseline calculation completes within acceptable time', function () {
1420
$action = app(CalculateBaselinesAction::class);
1521
$queueRepository = app(QueueMetricsRepository::class);

0 commit comments

Comments
 (0)