Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix intermittent events test #312

Merged
merged 1 commit into from
Jan 31, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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