(t *testing.T)
| 1602 | } |
| 1603 | |
| 1604 | func 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 | |
| 1644 | func TestCGROUPPrivate(t *testing.T) { |
| 1645 | if _, err := os.Stat("/proc/self/ns/cgroup"); errors.Is(err, os.ErrNotExist) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…