MCPcopy
hub / github.com/opencontainers/runc / TestProcessEmptyCaps

Function TestProcessEmptyCaps

libcontainer/integration/exec_test.go:278–322  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

276}
277
278func TestProcessEmptyCaps(t *testing.T) {
279 if testing.Short() {
280 return
281 }
282
283 config := newTemplateConfig(t, nil)
284 config.Capabilities = nil
285
286 container, err := newContainer(t, config)
287 ok(t, err)
288 defer destroyContainer(container)
289
290 var stdout strings.Builder
291 pconfig := libcontainer.Process{
292 Cwd: "/",
293 Args: []string{"sh", "-c", "cat /proc/self/status"},
294 Env: standardEnvironment,
295 Stdin: nil,
296 Stdout: &stdout,
297 Stderr: new(strings.Builder),
298 Init: true,
299 }
300 err = container.Run(&pconfig)
301 ok(t, err)
302
303 // Wait for process
304 waitProcess(&pconfig, t)
305
306 outputStatus := stdout.String()
307
308 lines := strings.Split(outputStatus, "\n")
309
310 effectiveCapsLine := ""
311 for _, l := range lines {
312 line := strings.TrimSpace(l)
313 if strings.Contains(line, "CapEff:") {
314 effectiveCapsLine = line
315 break
316 }
317 }
318
319 if effectiveCapsLine == "" {
320 t.Fatal("Couldn't find effective caps: ", outputStatus)
321 }
322}
323
324func TestProcessCaps(t *testing.T) {
325 if testing.Short() {

Callers

nothing calls this directly

Calls 8

newTemplateConfigFunction · 0.85
newContainerFunction · 0.85
okFunction · 0.85
destroyContainerFunction · 0.85
waitProcessFunction · 0.85
ContainsMethod · 0.80
RunMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…