coolify/tests/Unit/CheckTraefikVersionJobTest.php
Andras Bacsai 50d55a9509 refactor: send immediate Traefik version notifications instead of delayed aggregation
Move notification logic from NotifyOutdatedTraefikServersJob into CheckTraefikVersionForServerJob to send immediate notifications when outdated Traefik is detected. This is more suitable for cloud environments with thousands of servers.

Changes:
- CheckTraefikVersionForServerJob now sends notifications immediately after detecting outdated Traefik
- Remove NotifyOutdatedTraefikServersJob (no longer needed)
- Remove delay calculation logic from CheckTraefikVersionJob
- Update tests to reflect new immediate notification pattern

Trade-offs:
- Pro: Faster notifications (immediate alerts)
- Pro: Simpler codebase (removed complex delay calculation)
- Pro: Better scalability for thousands of servers
- Con: Teams may receive multiple notifications if they have many outdated servers

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 14:54:21 +01:00

27 lines
831 B
PHP

<?php
use App\Jobs\CheckTraefikVersionJob;
it('has correct retry configuration', function () {
$job = new CheckTraefikVersionJob;
expect($job->tries)->toBe(3);
});
it('returns early when traefik versions are empty', function () {
// This test verifies the early return logic when get_traefik_versions() returns empty array
$emptyVersions = [];
expect($emptyVersions)->toBeEmpty();
});
it('dispatches jobs in parallel for multiple servers', function () {
// This test verifies that the job dispatches CheckTraefikVersionForServerJob
// for each server without waiting for them to complete
$serverCount = 100;
// Verify that with parallel processing, we're not waiting for completion
// Each job is dispatched immediately without delay
expect($serverCount)->toBeGreaterThan(0);
});