@@ -139,6 +139,55 @@ describe("addDomainToCompose enabled filtering", () => {
139139 } ,
140140 ) ;
141141
142+ it . each ( [
143+ [
144+ "docker-compose" ,
145+ `services:
146+ frigate:
147+ image: frigate
148+ labels:
149+ traefik.enable: "true"
150+ traefik.http.routers.test-app-1-web.rule: Host(\`frigate.example.com\`)
151+ traefik.http.services.test-app-1-web.loadbalancer.server.port: 8971
152+ traefik.http.middlewares.stripprefix-test-app-1.stripprefix.prefixes: /api
153+ custom.label: preserved
154+ ` ,
155+ ] ,
156+ [
157+ "stack" ,
158+ `services:
159+ frigate:
160+ image: frigate
161+ deploy:
162+ labels:
163+ traefik.enable: "true"
164+ traefik.http.routers.test-app-1-web.rule: Host(\`frigate.example.com\`)
165+ traefik.http.services.test-app-1-web.loadbalancer.server.port: 8971
166+ traefik.http.middlewares.stripprefix-test-app-1.stripprefix.prefixes: /api
167+ custom.label: preserved
168+ ` ,
169+ ] ,
170+ ] as const ) (
171+ "removes stale mapping labels for a disabled domain from %s rebuilds" ,
172+ async ( composeType , staleComposeYaml ) => {
173+ composeYaml = staleComposeYaml ;
174+
175+ const result = await addDomainToCompose ( { ...baseCompose , composeType } , [
176+ { ...baseDomain , enabled : false } ,
177+ ] ) ;
178+
179+ const service = result ?. services ?. frigate ;
180+ const labels =
181+ composeType === "docker-compose"
182+ ? service ?. labels
183+ : service ?. deploy ?. labels ;
184+ expect ( labels ) . toMatchObject ( { "custom.label" : "preserved" } ) ;
185+ expect (
186+ Object . keys ( labels ?? { } ) . some ( ( label ) => label . includes ( "test-app-1" ) ) ,
187+ ) . toBe ( false ) ;
188+ } ,
189+ ) ;
190+
142191 it ( "emits labels only for the enabled domain when both are present" , async ( ) => {
143192 const result = await addDomainToCompose ( baseCompose , [
144193 { ...baseDomain , host : "enabled.example.com" , enabled : true } ,
0 commit comments