@@ -57,12 +57,14 @@ func TestCucumber(t *testing.T) {
57
57
58
58
func setup (s * godog.ScenarioContext ) {
59
59
t := s .TestingT ()
60
+ projectName := strings .Split (t .Name (), "/" )[1 ]
60
61
cli := e2e .NewCLI (t , e2e .WithEnv (
61
- fmt .Sprintf ("COMPOSE_PROJECT_NAME=%s" , strings . Split ( t . Name (), "/" )[ 1 ] ),
62
+ fmt .Sprintf ("COMPOSE_PROJECT_NAME=%s" , projectName ),
62
63
))
63
64
th := testHelper {
64
- T : t ,
65
- CLI : cli ,
65
+ T : t ,
66
+ CLI : cli ,
67
+ ProjectName : projectName ,
66
68
}
67
69
68
70
s .Before (func (ctx context.Context , sc * godog.Scenario ) (context.Context , error ) {
@@ -84,18 +86,20 @@ func setup(s *godog.ScenarioContext) {
84
86
85
87
type testHelper struct {
86
88
T * testing.T
89
+ ProjectName string
87
90
ComposeFile string
88
91
CommandOutput string
89
92
CommandExitCode int
90
93
CLI * e2e.CLI
91
94
}
92
95
93
96
func (th * testHelper ) serviceIsStatus (service , status string ) error {
97
+ serviceContainerName := fmt .Sprintf ("%s-%s-1" , strings .ToLower (th .ProjectName ), service )
98
+ statusRegex := fmt .Sprintf ("%s.*%s" , serviceContainerName , status )
94
99
res := th .CLI .RunDockerComposeCmd (th .T , "ps" , "-a" )
95
- statusRegex := fmt .Sprintf ("%s\\ s+%s" , service , status )
96
100
r , _ := regexp .Compile (statusRegex )
97
101
if ! r .MatchString (res .Combined ()) {
98
- return fmt .Errorf ("Missing/incorrect ps output:\n %s" , res .Combined ())
102
+ return fmt .Errorf ("Missing/incorrect ps output:\n %s\n regex: \n %s " , res .Combined (), statusRegex )
99
103
}
100
104
return nil
101
105
}
0 commit comments