MCPcopy
hub / github.com/containerd/containerd / testGetUsernsFD

Function testGetUsernsFD

core/mount/mount_idmapped_linux_test.go:94–140  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

92}
93
94func testGetUsernsFD(t *testing.T) {
95 for idx, tc := range []struct {
96 uidMaps string
97 gidMaps string
98 hasErr bool
99 }{
100 {
101 uidMaps: "0:1000:100",
102 gidMaps: "0:1000:100",
103 hasErr: false,
104 },
105 {
106 uidMaps: "0:1000:100,100:2000:200",
107 gidMaps: "0:1000:100,100:2000:200",
108 hasErr: false,
109 },
110 {
111 uidMaps: "100:1000:100",
112 gidMaps: "0:-1:100",
113 hasErr: true,
114 },
115 {
116 uidMaps: "100:1000:100",
117 gidMaps: "-1:1000:100",
118 hasErr: true,
119 },
120 {
121 uidMaps: "100:1000:100",
122 gidMaps: "0:1000:-1",
123 hasErr: true,
124 },
125 {
126 uidMaps: "100:1000:100",
127 gidMaps: "0:1000:-1,100:1000:100",
128 hasErr: true,
129 },
130 } {
131 t.Run(fmt.Sprintf("#%v", idx), func(t *testing.T) {
132 _, err := GetUsernsFD(tc.uidMaps, tc.gidMaps)
133 if tc.hasErr {
134 require.Error(t, err)
135 } else {
136 require.NoError(t, err)
137 }
138 })
139 }
140}
141
142func testIDMapMount(t *testing.T) {
143 usernsFD, err := getUsernsFD(testUIDMaps, testGIDMaps)

Callers

nothing calls this directly

Calls 3

GetUsernsFDFunction · 0.85
RunMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…