host: fix TestHostInfoStat_String

TestHostInfoStat_String has been broken since kernelArch has been
introduced. Fix it.

Also adjust the error message to show the wanted string, aligned with
the gotten string so it's easier to spot differences.
This commit is contained in:
Tobias Klauser 2020-02-13 14:39:25 +01:00
parent a9d510e7e5
commit 7bee6a934d
1 changed files with 2 additions and 2 deletions

View File

@ -86,9 +86,9 @@ func TestHostInfoStat_String(t *testing.T) {
BootTime: 1447040000,
HostID: "edfd25ff-3c9c-b1a4-e660-bd826495ad35",
}
e := `{"hostname":"test","uptime":3000,"bootTime":1447040000,"procs":100,"os":"linux","platform":"ubuntu","platformFamily":"","platformVersion":"","kernelVersion":"","virtualizationSystem":"","virtualizationRole":"","hostid":"edfd25ff-3c9c-b1a4-e660-bd826495ad35"}`
e := `{"hostname":"test","uptime":3000,"bootTime":1447040000,"procs":100,"os":"linux","platform":"ubuntu","platformFamily":"","platformVersion":"","kernelVersion":"","kernelArch":"","virtualizationSystem":"","virtualizationRole":"","hostid":"edfd25ff-3c9c-b1a4-e660-bd826495ad35"}`
if e != fmt.Sprintf("%v", v) {
t.Errorf("HostInfoStat string is invalid: %v", v)
t.Errorf("HostInfoStat string is invalid:\ngot %v\nwant %v", v, e)
}
}