mirror of
https://github.com/netbirdio/netbird.git
synced 2024-11-21 23:53:14 +01:00
Use regex in formatter test because order of attributes can vary (#705)
Fix test for formatter where the attributes are changing order for some reason to not have random test failures. Used regex to catch both cases.
This commit is contained in:
parent
f984b8a091
commit
9a88ed3cda
@ -20,8 +20,7 @@ func TestLogMessageFormat(t *testing.T) {
|
||||
formatter := NewTextFormatter()
|
||||
result, _ := formatter.Format(someEntry)
|
||||
|
||||
expectedString := "2021-02-21T01:10:30Z WARN [att1: 1, att2: 2] some/fancy/path.go:46: Some Message\n"
|
||||
parsedString := string(result)
|
||||
assert.Equal(t, expectedString, parsedString, "The log messages don't match.")
|
||||
|
||||
expectedString := "^2021-02-21T01:10:30Z WARN \\[(att1: 1, att2: 2|att2: 2, att1: 1)\\] some/fancy/path.go:46: Some Message\\s+$"
|
||||
assert.Regexp(t, expectedString, parsedString)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user