@@ -320,6 +320,7 @@ func TestRemoveOrphaned(t *testing.T) {
320320
321321func TestComposeFileSetByDotEnv (t * testing.T ) {
322322 c := NewCLI (t )
323+ defer c .cleanupWithDown (t , "dotenv" )
323324
324325 cmd := c .NewDockerComposeCmd (t , "config" )
325326 cmd .Dir = filepath .Join ("." , "fixtures" , "dotenv" )
@@ -335,6 +336,7 @@ func TestComposeFileSetByDotEnv(t *testing.T) {
335336
336337func TestComposeFileSetByProjectDirectory (t * testing.T ) {
337338 c := NewCLI (t )
339+ defer c .cleanupWithDown (t , "dotenv" )
338340
339341 dir := filepath .Join ("." , "fixtures" , "dotenv" , "development" )
340342 cmd := c .NewDockerComposeCmd (t , "--project-directory" , dir , "config" )
@@ -347,6 +349,7 @@ func TestComposeFileSetByProjectDirectory(t *testing.T) {
347349
348350func TestComposeFileSetByEnvFile (t * testing.T ) {
349351 c := NewCLI (t )
352+ defer c .cleanupWithDown (t , "dotenv" )
350353
351354 dotEnv , err := os .CreateTemp (t .TempDir (), ".env" )
352355 assert .NilError (t , err )
@@ -370,6 +373,7 @@ COMPOSE_PROFILES=test
370373
371374func TestNestedDotEnv (t * testing.T ) {
372375 c := NewCLI (t )
376+ defer c .cleanupWithDown (t , "nested" )
373377
374378 cmd := c .NewDockerComposeCmd (t , "run" , "echo" )
375379 cmd .Dir = filepath .Join ("." , "fixtures" , "nested" )
@@ -381,6 +385,7 @@ func TestNestedDotEnv(t *testing.T) {
381385
382386 cmd = c .NewDockerComposeCmd (t , "run" , "echo" )
383387 cmd .Dir = filepath .Join ("." , "fixtures" , "nested" , "sub" )
388+ defer c .cleanupWithDown (t , "nested" )
384389 res = icmd .RunCmd (cmd )
385390 res .Assert (t , icmd.Expected {
386391 ExitCode : 0 ,
@@ -392,9 +397,7 @@ func TestNestedDotEnv(t *testing.T) {
392397func TestUnnecessaryResources (t * testing.T ) {
393398 const projectName = "compose-e2e-unnecessary-resources"
394399 c := NewParallelCLI (t )
395- t .Cleanup (func () {
396- c .RunDockerComposeCmd (t , "-p" , projectName , "down" , "-t=0" )
397- })
400+ defer c .cleanupWithDown (t , projectName )
398401
399402 res := c .RunDockerComposeCmdNoCheck (t , "-f" , "./fixtures/external/compose.yaml" , "-p" , projectName , "up" , "-d" )
400403 res .Assert (t , icmd.Expected {
0 commit comments