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

Function TestFileDescriptorsInfo

proc_test.go:250–274  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

248}
249
250func TestFileDescriptorsInfo(t *testing.T) {
251 p1, err := getProcFixtures(t).Proc(26231)
252 if err != nil {
253 t.Fatal(err)
254 }
255 fdinfos, err := p1.FileDescriptorsInfo()
256 if err != nil {
257 t.Fatal(err)
258 }
259 sort.Sort(fdinfos)
260 var want = ProcFDInfos{
261 ProcFDInfo{FD: "0", Pos: "0", Flags: "02004000", MntID: "13", InotifyInfos: []InotifyInfo{
262 {WD: "3", Ino: "1", Sdev: "34", Mask: "fce"},
263 {WD: "2", Ino: "1300016", Sdev: "fd00002", Mask: "fce"},
264 {WD: "1", Ino: "2e0001", Sdev: "fd00000", Mask: "fce"},
265 }},
266 ProcFDInfo{FD: "1", Pos: "0", Flags: "02004002", MntID: "13", InotifyInfos: nil},
267 ProcFDInfo{FD: "10", Pos: "0", Flags: "02004002", MntID: "9", InotifyInfos: nil},
268 ProcFDInfo{FD: "2", Pos: "0", Flags: "02004002", MntID: "9", InotifyInfos: nil},
269 ProcFDInfo{FD: "3", Pos: "0", Flags: "02004002", MntID: "9", InotifyInfos: nil},
270 }
271 if diff := cmp.Diff(want, fdinfos); diff != "" {
272 t.Fatalf("unexpected fdinfos (-want +got):\n%s", diff)
273 }
274}
275
276type byUintptr []uintptr
277

Callers

nothing calls this directly

Calls 3

getProcFixturesFunction · 0.85
ProcMethod · 0.80
FileDescriptorsInfoMethod · 0.80

Tested by

no test coverage detected