Skip to content

Commit

Permalink
Fix flaky test
Browse files Browse the repository at this point in the history
Using line break in the regexp make the test flaky. Depending on the
file order, the first line break will not match since the first line of
the output doesn't start by one.
  • Loading branch information
hush-hush committed Mar 17, 2023
1 parent 54c629d commit 66a5485
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions comp/core/flare/helpers/perm_info_win_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,15 @@ func TestPermsFileCommit(t *testing.T) {
b, err := pi.commit()
require.NoError(t, err)

assert.Regexp(t, "\nFile: C:\\\\.+\\\\file1\n", string(b))
assert.Regexp(t, "\nFile: C:\\\\.+\\\\file2\n", string(b))
assert.Regexp(t, "\ncould not stat file.+C:\\\\.+\\\\file3", string(b))
// file1 and file2 header
assert.Regexp(t, "(?ms)^File: C:\\\\.+\\\\file1$", string(b))
assert.Regexp(t, "(?ms)^File: C:\\\\.+\\\\file2$", string(b))
assert.Regexp(t, "(?ms)^File: C:\\\\.+\\\\file3$", string(b))

// check no error was raised for file21 and file2
assert.NotRegexp(t, "(?ms)^could not stat file: C:\\\\.+\\\\file1", string(b))
assert.NotRegexp(t, "(?ms)^could not stat file: C:\\\\.+\\\\file2", string(b))

// check that an error was raised for file3
assert.Regexp(t, "(?ms)^could not stat file.+C:\\\\.+\\\\file3", string(b))
}

0 comments on commit 66a5485

Please sign in to comment.