Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tobias-kuendig committed Jun 13, 2024
1 parent ebe4714 commit 52409d0
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions sensor/cpu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestCPUUsage(t *testing.T) {
require.EqualValues(t, output, res)
}

func TestCPUTemp(t *testing.T) {
func TestCPUTemp_Intel(t *testing.T) {
input := `
coretemp-isa-0000
Adapter: ISA adapter
Expand All @@ -57,10 +57,6 @@ func TestCPUTemp(t *testing.T) {
pch_cannonlake-virtual-0
Adapter: Virtual device
temp1: +37.0°C
k10temp-pci-00c3
Adapter: PCI adapter
Tctl: +39.6°C
`
output := &entity.Payload{
State: "99.0",
Expand All @@ -72,7 +68,30 @@ func TestCPUTemp(t *testing.T) {
"core_4": "38.0",
"core_5": "39.0",
"temp_1": "37.0",
"Tctl": "39.6",
},
}

c := NewCPUTemp(entity.Meta{"celsius": true})

res, err := c.process(input)
require.NoError(t, err)
require.EqualValues(t, output, res)
}

func TestCPUTemp_AMD(t *testing.T) {
input := `
k10temp-pci-00c3
Adapter: PCI adapter
Tctl: +39.6°C
acpitz-acpi-0
Adapter: ACPI interface
temp1: +27.8°C (crit = +119.0°C)
`
output := &entity.Payload{
State: "39.6",
Attributes: map[string]interface{}{
"temp_1": "27.8",
},
}

Expand Down

0 comments on commit 52409d0

Please sign in to comment.