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

Function TestTmpfsCopyUp

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

Source from the content-addressed store, hash-verified

1602}
1603
1604func TestTmpfsCopyUp(t *testing.T) {
1605 if testing.Short() {
1606 return
1607 }
1608
1609 config := newTemplateConfig(t, nil)
1610 config.Mounts = append(config.Mounts, &configs.Mount{
1611 Source: "tmpfs",
1612 Destination: "/etc",
1613 Device: "tmpfs",
1614 Extensions: configs.EXT_COPYUP,
1615 })
1616
1617 container, err := newContainer(t, config)
1618 ok(t, err)
1619 defer destroyContainer(container)
1620
1621 var stdout strings.Builder
1622 pconfig := libcontainer.Process{
1623 Args: []string{"ls", "/etc/passwd"},
1624 Env: standardEnvironment,
1625 Stdin: nil,
1626 Stdout: &stdout,
1627 Stderr: new(strings.Builder),
1628 Init: true,
1629 }
1630 err = container.Run(&pconfig)
1631 ok(t, err)
1632
1633 // Wait for process
1634 waitProcess(&pconfig, t)
1635
1636 outputLs := stdout.String()
1637
1638 // Check that the ls output has /etc/passwd
1639 if !strings.Contains(outputLs, "/etc/passwd") {
1640 t.Fatalf("/etc/passwd not copied up as expected: %v", outputLs)
1641 }
1642}
1643
1644func TestCGROUPPrivate(t *testing.T) {
1645 if _, err := os.Stat("/proc/self/ns/cgroup"); errors.Is(err, os.ErrNotExist) {

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…