diff --git a/host/host_test.go b/host/host_test.go index 3f0d97ce2..008f2c3d4 100644 --- a/host/host_test.go +++ b/host/host_test.go @@ -157,10 +157,8 @@ func TestTemperatureStat_StringNotSet(t *testing.T) { SensorKey: "CPU", Temperature: 1.1, } - s := `{"sensorKey":"CPU","temperature":1.1,"sensorHigh":0,"sensorCritical":0}` - if s != fmt.Sprintf("%v", v) { - t.Errorf("TemperatureStat string is invalid, %v", fmt.Sprintf("%v", v)) - } + expected := `{"sensorKey":"CPU","temperature":1.1,"sensorHigh":0,"sensorCritical":0}` + require.Equalf(t, expected, v.String(), "TemperatureStat string is invalid, %s", v) } func TestTemperatureStat_StringOptional(t *testing.T) { @@ -176,9 +174,9 @@ func TestTemperatureStat_StringOptional(t *testing.T) { "alarm": 80.3, }, } - var expected TemperatureStat - require.NoError(t, json.Unmarshal([]byte(v.String()), &expected)) - require.EqualValues(t, expected, v) + var actual TemperatureStat + require.NoError(t, json.Unmarshal([]byte(v.String()), &actual)) + require.EqualValues(t, v, actual) } func TestVirtualization(t *testing.T) {