Skip to content

Commit 41350e5

Browse files
committed
Check for workflow id more specifically in tests
More than just the workflow id is printed now.
1 parent 8b8fad1 commit 41350e5

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

testing/pgo_cli/cluster_create_test.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ package pgo_cli_test
1717

1818
import (
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

Comments
 (0)