From dee3f07b0afc36bd41014679989e9610a4c1e8a7 Mon Sep 17 00:00:00 2001 From: Phillip Wittrock Date: Mon, 4 Jan 2016 10:50:08 -0800 Subject: [PATCH] resolves #1030 oomparser_test should get the current year for matching the time of death. --- utils/oomparser/oomparser_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/utils/oomparser/oomparser_test.go b/utils/oomparser/oomparser_test.go index 7da55e61..8b0e2733 100644 --- a/utils/oomparser/oomparser_test.go +++ b/utils/oomparser/oomparser_test.go @@ -16,8 +16,10 @@ package oomparser import ( "bufio" + "fmt" "os" "reflect" + "strconv" "testing" "time" ) @@ -92,7 +94,8 @@ func TestGetProcessNamePid(t *testing.T) { } const longForm = "Jan _2 15:04:05 2006" - correctTime, err := time.ParseInLocation(longForm, "Jan 21 22:01:49 2015", time.Local) + stringYear := strconv.Itoa(time.Now().Year()) + correctTime, err := time.ParseInLocation(longForm, fmt.Sprintf("Jan 21 22:01:49 %s", stringYear), time.Local) couldParseLine, err = getProcessNamePid(endLine, currentOomInstance) if err != nil { t.Errorf("good line fed to getProcessNamePid should yield no error, but had error %v", err)