Merge pull request #1031 from pwittrock/fix_oomparsertest
resolves #1030 oomparser_test should get the current year
This commit is contained in:
commit
38cf3a0972
@ -16,8 +16,10 @@ package oomparser
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"strconv"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@ -92,7 +94,8 @@ func TestGetProcessNamePid(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const longForm = "Jan _2 15:04:05 2006"
|
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)
|
couldParseLine, err = getProcessNamePid(endLine, currentOomInstance)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("good line fed to getProcessNamePid should yield no error, but had error %v", err)
|
t.Errorf("good line fed to getProcessNamePid should yield no error, but had error %v", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user