From 7bee6a934d30624737dc70a30f4e66f0bf060662 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Thu, 13 Feb 2020 14:39:25 +0100 Subject: [PATCH] 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. --- host/host_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/host/host_test.go b/host/host_test.go index 1b34f69..b4db399 100644 --- a/host/host_test.go +++ b/host/host_test.go @@ -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) } }