MCPcopy Create free account
hub / github.com/containerd/cgroups / testDeviceFilter

Function testDeviceFilter

cgroup2/devicefilter_test.go:39–50  ·  view source on GitHub ↗
(t testing.TB, devices []specs.LinuxDeviceCgroup, expectedStr string)

Source from the content-addressed store, hash-verified

37}
38
39func testDeviceFilter(t testing.TB, devices []specs.LinuxDeviceCgroup, expectedStr string) {
40 insts, _, err := DeviceFilter(devices)
41 require.NoErrorf(t, err, "%s: (devices: %+v)", t.Name(), devices)
42
43 s := insts.String()
44 t.Logf("%s: devices: %+v\n%s", t.Name(), devices, s)
45 if expectedStr != "" {
46 hashed := hash(s, "//")
47 expectedHashed := hash(expectedStr, "//")
48 require.Equal(t, expectedHashed, hashed)
49 }
50}
51
52func TestDeviceFilter_Nil(t *testing.T) {
53 expected := `

Calls 4

DeviceFilterFunction · 0.85
hashFunction · 0.85
NameMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…