@@ -21,7 +21,9 @@ import (
2121 "os"
2222 "path/filepath"
2323 "runtime"
24+ "strings"
2425 "testing"
26+ "time"
2527
2628 "gotest.tools/v3/assert"
2729 "gotest.tools/v3/icmd"
@@ -121,17 +123,19 @@ services:
121123 fmt .Printf ("Docker Compose YAML content:\n %s\n " , dockerComposeYAML )
122124
123125 // Run compose up with env-file
124- upCmd := base .ComposeCmd ("-f " , comp . YAMLFullPath () , "--env-file " , envFilePath , "up" , "-d" )
126+ upCmd := base .ComposeCmd ("--env-file " , envFilePath , "-f " , comp . YAMLFullPath () , "up" , "-d" )
125127 upCmd .AssertOK ()
128+ time .Sleep (5 * time .Second )
126129 defer base .ComposeCmd ("-f" , comp .YAMLFullPath (), "down" ).AssertOK ()
127130
128- // Print compose logs
129- logsCmd := base .ComposeCmd ("-f" , comp .YAMLFullPath (), "logs" )
130- fmt .Printf ("Compose logs:\n %s\n " , logsCmd .Run ().Combined ())
131+ psCmd := base .ComposeCmd ("-f" , comp .YAMLFullPath (), "ps" )
132+ fmt .Printf ("Compose ps output:\n %s\n " , psCmd .Run ().Combined ())
131133
132- // Get container ID
133- containerID := base .ComposeCmd ("-f" , comp .YAMLFullPath (), "ps" , "-q" ).OutLines ()[0 ]
134+ containerID := strings .TrimSpace (base .ComposeCmd ("-f" , comp .YAMLFullPath (), "ps" , "-q" ).Out ())
134135 fmt .Printf ("Container ID: %s\n " , containerID )
136+ if containerID == "" {
137+ t .Fatalf ("Failed to get container ID" )
138+ }
135139
136140 // Execute command in the container
137141 execCmd := base .Cmd ("exec" , containerID , "cat" , "/tmp/test_output" )
0 commit comments