@@ -17,7 +17,6 @@ package pgo_cli_test
1717
1818import (
1919 "regexp"
20- "strings"
2120 "testing"
2221 "time"
2322
@@ -31,15 +30,14 @@ func TestClusterCreate(t *testing.T) {
3130 withNamespace (t , func (namespace func () string ) {
3231 t .Run ("create cluster" , func (t * testing.T ) {
3332 t .Run ("creates a workflow" , func (t * testing.T ) {
33+ workflow := regexp .MustCompile (`(?m:^workflow id.*?(\S+)$)` )
34+
3435 output , err := pgo ("create" , "cluster" , "mycluster" , "-n" , namespace ()).Exec (t )
3536 defer teardownCluster (t , namespace (), "mycluster" , time .Now ())
3637 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" )
4139
42- _ , err = pgo ("show" , "workflow" , workflow , "-n" , namespace ()).Exec (t )
40+ _ , err = pgo ("show" , "workflow" , workflow . FindStringSubmatch ( output )[ 1 ] , "-n" , namespace ()).Exec (t )
4341 require .NoError (t , err )
4442 })
4543 })
0 commit comments