...
1
2
3
4
5
6
7
8
9
10
11
12
13
14 package procfs
15
16 import "testing"
17
18 func TestProcSnmp6(t *testing.T) {
19 p, err := getProcFixtures(t).Proc(26231)
20 if err != nil {
21 t.Fatal(err)
22 }
23
24 procSnmp6, err := p.Snmp6()
25 if err != nil {
26 t.Fatal(err)
27 }
28
29 for _, test := range []struct {
30 name string
31 want float64
32 have float64
33 }{
34 {name: "pid", want: 26231, have: float64(procSnmp6.PID)},
35 {name: "Ip6InReceives", want: 92166, have: *procSnmp6.Ip6.InReceives},
36 {name: "Ip6InDelivers", want: 92053, have: *procSnmp6.Ip6.InDelivers},
37 {name: "Ip6OutNoRoutes", want: 169, have: *procSnmp6.Ip6.OutNoRoutes},
38 {name: "Ip6InOctets", want: 113479132, have: *procSnmp6.Ip6.InOctets},
39 {name: "Icmp6InMsgs", want: 142, have: *procSnmp6.Icmp6.InMsgs},
40 {name: "Udp6InDatagrams", want: 2016, have: *procSnmp6.Udp6.InDatagrams},
41 {name: "UdpLite6InDatagrams", want: 0, have: *procSnmp6.UdpLite6.InDatagrams},
42 } {
43 if test.want != test.have {
44 t.Errorf("want %s %f, have %f", test.name, test.want, test.have)
45 }
46 }
47
48 }
49
View as plain text