MCPcopy
hub / github.com/prometheus/node_exporter / TestInterrupts

Function TestInterrupts

collector/interrupts_linux_test.go:23–51  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

21)
22
23func TestInterrupts(t *testing.T) {
24 file, err := os.Open("fixtures/proc/interrupts")
25 if err != nil {
26 t.Fatal(err)
27 }
28 defer file.Close()
29
30 interrupts, err := parseInterrupts(file)
31 if err != nil {
32 t.Fatal(err)
33 }
34
35 if want, got := "5031", interrupts["NMI"].values[1]; want != got {
36 t.Errorf("want interrupts value %s, got %s", want, got)
37 }
38
39 if want, got := "4968", interrupts["NMI"].values[3]; want != got {
40 t.Errorf("want interrupts value %s, got %s", want, got)
41 }
42
43 if want, got := "IR-IO-APIC-edge", interrupts["12"].info; want != got {
44 t.Errorf("want interrupts info %s, got %s", want, got)
45 }
46
47 if want, got := "i8042", interrupts["12"].devices; want != got {
48 t.Errorf("want interrupts devices %s, got %s", want, got)
49 }
50
51}
52
53// https://github.com/prometheus/node_exporter/issues/2557
54// On aarch64 the interrupts file can have zero spaces between the label of

Callers

nothing calls this directly

Calls 2

parseInterruptsFunction · 0.85
CloseMethod · 0.65

Tested by

no test coverage detected