diff --git a/command/alloc_status_test.go b/command/alloc_status_test.go index e4b5c239c..b3c7fef20 100644 --- a/command/alloc_status_test.go +++ b/command/alloc_status_test.go @@ -143,15 +143,8 @@ func TestAllocStatusCommand_Run(t *testing.T) { t.Fatalf("expected to have 'Modified' but saw: %s", out) } - if !strings.Contains(out, "Modified") { - t.Fatalf("expected to have 'Modified' but saw: %s", out) - } - nodeNameRegexpStr := fmt.Sprintf(`\nNode Name\s+= %s\n`, regexp.QuoteMeta(nodeName)) - nodeNameRegexp := regexp.MustCompile(nodeNameRegexpStr) - if !nodeNameRegexp.MatchString(out) { - t.Fatalf("expected to have 'Node Name' but saw: %s", out) - } + require.Regexp(t, regexp.MustCompile(nodeNameRegexpStr), out) ui.OutputWriter.Reset() diff --git a/command/job_status_test.go b/command/job_status_test.go index f4a71c7b8..745af018e 100644 --- a/command/job_status_test.go +++ b/command/job_status_test.go @@ -155,10 +155,7 @@ func TestJobStatusCommand_Run(t *testing.T) { nodeNameHeaderStr := "Node Name" nodeNameHeaderIndex := strings.Index(allocationsTableStr, nodeNameHeaderStr) nodeNameRegexpStr := fmt.Sprintf(`.*%s.*\n.{%d}%s`, nodeNameHeaderStr, nodeNameHeaderIndex, regexp.QuoteMeta(nodeName)) - nodeNameRegexp := regexp.MustCompile(nodeNameRegexpStr) - if !nodeNameRegexp.MatchString(out) { - t.Fatalf("expected to have 'Node Name' but saw: %s", out) - } + require.Regexp(t, regexp.MustCompile(nodeNameRegexpStr), out) ui.ErrorWriter.Reset() ui.OutputWriter.Reset()