Skip to content

Commit

Permalink
test: fix intermittent events test (#312)
Browse files Browse the repository at this point in the history
Signed-off-by: Salim Afiune Maya <[email protected]>
  • Loading branch information
afiune committed Jan 31, 2021
1 parent 9793261 commit d69983b
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions integration/event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,21 +103,25 @@ func TestEventCommandListTimeRange(t *testing.T) {
)

out, err, exitcode := LaceworkCLIWithTOMLConfig("event", "list", "--start", from.Format(time.RFC3339), "--end", now.Format(time.RFC3339))
assert.Contains(t, out.String(), "EVENT ID",
"STDOUT table headers changed, please check")
assert.Contains(t, out.String(), "TYPE",
"STDOUT table headers changed, please check")
assert.Contains(t, out.String(), "SEVERITY",
"STDOUT table headers changed, please check")
assert.Contains(t, out.String(), "START TIME",
"STDOUT table headers changed, please check")
assert.Contains(t, out.String(), "END TIME",
"STDOUT table headers changed, please check")
assert.Empty(t,
err.String(),
"STDERR should be empty")
assert.Equal(t, 0, exitcode,
"EXITCODE is not the expected one")

// only verify the table headers if there are events
if !strings.Contains(out.String(), "There are no events in your account in the specified time range.") {
assert.Contains(t, out.String(), "EVENT ID",
"STDOUT table headers changed, please check")
assert.Contains(t, out.String(), "TYPE",
"STDOUT table headers changed, please check")
assert.Contains(t, out.String(), "SEVERITY",
"STDOUT table headers changed, please check")
assert.Contains(t, out.String(), "START TIME",
"STDOUT table headers changed, please check")
assert.Contains(t, out.String(), "END TIME",
"STDOUT table headers changed, please check")
}
}

func TestEventCommandOpenError(t *testing.T) {
Expand Down

0 comments on commit d69983b

Please sign in to comment.