Files
coolify/tests/Unit/TraefikDockerNetworkLabelTest.php
Andras Bacsai 1c25b58dc8 fix(proxy): set Traefik network labels for compose services
Add the Coolify network label when no user-selected Traefik network exists, while preserving custom labels for applications and services.
2026-08-15 18:31:32 +02:00

31 lines
1019 B
PHP

<?php
it('adds the Coolify network when the user did not select a Traefik network', function () {
$labels = addTraefikDockerNetworkLabel(collect([
'traefik.enable=true',
]), 'app-uuid');
expect($labels->values()->all())->toContain('traefik.docker.network=app-uuid');
});
it('preserves a user-selected Traefik network', function () {
$labels = addTraefikDockerNetworkLabel(collect([
'traefik.enable=true',
'traefik.docker.network=custom-network',
]), 'app-uuid');
expect($labels->values()->all())
->toContain('traefik.docker.network=custom-network')
->not->toContain('traefik.docker.network=app-uuid');
});
it('treats a bare user-provided Traefik network label as authoritative', function () {
$labels = addTraefikDockerNetworkLabel(collect([
'traefik.docker.network',
]), 'app-uuid');
expect($labels->values()->all())
->toContain('traefik.docker.network')
->not->toContain('traefik.docker.network=app-uuid');
});