MCPcopy Create free account
hub / github.com/prometheus/procfs / TestProcNetDev

Function TestProcNetDev

net_dev_test.go:65–89  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

63}
64
65func TestProcNetDev(t *testing.T) {
66 p, err := getProcFixtures(t).Proc(26231)
67 if err != nil {
68 t.Fatal(err)
69 }
70
71 netDev, err := p.NetDev()
72 if err != nil {
73 t.Fatal(err)
74 }
75
76 lines := map[string]NetDevLine{
77 "lo": {Name: "lo"},
78 "eth0": {Name: "eth0", RxBytes: 438, RxPackets: 5, TxBytes: 648, TxPackets: 8},
79 }
80
81 if want, have := len(lines), len(netDev); want != have {
82 t.Errorf("want %d parsed net/dev lines, have %d", want, have)
83 }
84 for _, line := range netDev {
85 if want, have := lines[line.Name], line; want != have {
86 t.Errorf("%s: want %v, have %v", line.Name, want, have)
87 }
88 }
89}

Callers

nothing calls this directly

Calls 3

getProcFixturesFunction · 0.85
ProcMethod · 0.80
NetDevMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…