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

Function TestMountStats

mountstats_test.go:24–510  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

22)
23
24func TestMountStats(t *testing.T) {
25 tests := []struct {
26 name string
27 s string
28 mounts []*Mount
29 invalid bool
30 }{
31 {
32 name: "no devices",
33 s: `hello`,
34 },
35 {
36 name: "device has too few fields",
37 s: `device foo`,
38 invalid: true,
39 },
40 {
41 name: "device incorrect format",
42 s: `device rootfs BAD on / with fstype rootfs`,
43 invalid: true,
44 },
45 {
46 name: "device incorrect format",
47 s: `device rootfs mounted BAD / with fstype rootfs`,
48 invalid: true,
49 },
50 {
51 name: "device incorrect format",
52 s: `device rootfs mounted on / BAD fstype rootfs`,
53 invalid: true,
54 },
55 {
56 name: "device incorrect format",
57 s: `device rootfs mounted on / with BAD rootfs`,
58 invalid: true,
59 },
60 {
61 name: "device rootfs cannot have stats",
62 s: `device rootfs mounted on / with fstype rootfs stats`,
63 invalid: true,
64 },
65 {
66 name: "NFSv4 device with too little info",
67 s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs4 statvers=1.1\nopts:",
68 invalid: true,
69 },
70 {
71 name: "NFSv4 device with bad bytes",
72 s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs4 statvers=1.1\nbytes: 0",
73 invalid: true,
74 },
75 {
76 name: "NFSv4 device with bad events",
77 s: "device 192.168.1.1:/srv mounted on /mnt/nfs with fstype nfs4 statvers=1.1\nevents: 0",
78 invalid: true,
79 },
80 {
81 name: "NFSv4 device with bad per-op stats",

Callers

nothing calls this directly

Calls 4

parseMountStatsFunction · 0.85
getProcFixturesFunction · 0.85
ProcMethod · 0.80
MountStatsMethod · 0.80

Tested by

no test coverage detected