Skip to content

Commit

Permalink
Update functional and unit tests (#43)
Browse files Browse the repository at this point in the history
Updated TestTextFormatLogstash as the new logrus version
doesn't append a space in the end of line.

In addition, logrus.DefaultTimestampFormat was removed
and instead using time.RFC3339.
  • Loading branch information
ripcurld0 authored Aug 22, 2017
1 parent 41029b8 commit ebf0085
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion functional_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func TestTextFormatLogstash(t *testing.T) {

log.Warning("this is a warning message!")
mTime := time.Now()
expected := fmt.Sprintf(`time="%s" level=warning msg="this is a warning message!" HOSTNAME=localhost USERNAME=root
expected := fmt.Sprintf(`time="%s" level=warning msg="this is a warning message!" HOSTNAME=localhost USERNAME=root
`, mTime.Format(time.Kitchen))
if buffer.String() != expected {
t.Errorf("expected JSON to be '%#v' but got '%#v'", expected, buffer.String())
Expand Down
2 changes: 1 addition & 1 deletion hook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func TestDefaultFormatterWithEmptyFields(t *testing.T) {
"\"Key1\":\"Value1\"",
"\"@version\":\"1\"",
"\"type\":\"log\"",
fmt.Sprintf("\"@timestamp\":\"%s\"", now.Format(logrus.DefaultTimestampFormat)),
fmt.Sprintf("\"@timestamp\":\"%s\"", now.Format(time.RFC3339)),
}

for _, exp := range expected {
Expand Down

0 comments on commit ebf0085

Please sign in to comment.