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

Function validateNetDevSNMP6

net_dev_snmp6_test.go:53–86  ·  view source on GitHub ↗
(have NetDevSNMP6)

Source from the content-addressed store, hash-verified

51}
52
53func validateNetDevSNMP6(have NetDevSNMP6) error {
54 var wantNetDevSNMP6 = map[string]map[string]uint64{
55 "eth0": {
56 "ifIndex": 1,
57 "Ip6InOctets": 14064059261,
58 "Ip6OutOctets": 811213622,
59 "Icmp6InMsgs": 53293,
60 "Icmp6OutMsgs": 20400,
61 },
62 "eth1": {
63 "ifIndex": 2,
64 "Ip6InOctets": 303177290674,
65 "Ip6OutOctets": 29245052746,
66 "Icmp6InMsgs": 37911,
67 "Icmp6OutMsgs": 114015,
68 },
69 }
70
71 for wantIface, wantData := range wantNetDevSNMP6 {
72 if haveData, ok := have[wantIface]; ok {
73 for wantStat, wantVal := range wantData {
74 if haveVal, ok := haveData[wantStat]; !ok {
75 return fmt.Errorf("stat %s missing from %s test data", wantStat, wantIface)
76 } else if wantVal != haveVal {
77 return fmt.Errorf("%s - %s: want %d, have %d", wantIface, wantStat, wantVal, haveVal)
78 }
79 }
80 } else {
81 return fmt.Errorf("%s not found in test data", wantIface)
82 }
83 }
84
85 return nil
86}

Callers 2

TestNetDevSNMP6Function · 0.85
TestProcNetDevSNMP6Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…