mirror of
https://github.com/netbirdio/netbird.git
synced 2025-02-16 18:21:24 +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()
|
formatter := NewTextFormatter()
|
||||||
result, _ := formatter.Format(someEntry)
|
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)
|
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