@@ -17,7 +17,6 @@ package pgo_cli_test
17
17
18
18
import (
19
19
"regexp"
20
- "strings"
21
20
"testing"
22
21
"time"
23
22
@@ -31,15 +30,14 @@ func TestClusterCreate(t *testing.T) {
31
30
withNamespace (t , func (namespace func () string ) {
32
31
t .Run ("create cluster" , func (t * testing.T ) {
33
32
t .Run ("creates a workflow" , func (t * testing.T ) {
33
+ workflow := regexp .MustCompile (`(?m:^workflow id.*?(\S+)$)` )
34
+
34
35
output , err := pgo ("create" , "cluster" , "mycluster" , "-n" , namespace ()).Exec (t )
35
36
defer teardownCluster (t , namespace (), "mycluster" , time .Now ())
36
37
require .NoError (t , err )
37
- require .Contains (t , output , "workflow id" )
38
-
39
- workflow := regexp .MustCompile (`\S+$` ).FindString (strings .TrimSpace (output ))
40
- require .NotEmpty (t , workflow )
38
+ require .Regexp (t , workflow , output , "expected pgo to show the workflow" )
41
39
42
- _ , err = pgo ("show" , "workflow" , workflow , "-n" , namespace ()).Exec (t )
40
+ _ , err = pgo ("show" , "workflow" , workflow . FindStringSubmatch ( output )[ 1 ] , "-n" , namespace ()).Exec (t )
43
41
require .NoError (t , err )
44
42
})
45
43
})
0 commit comments