mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
daemon/oci_linux_test: Skip privileged tests when non-root
These tests fail when run by a non-root user === RUN TestTmpfsDevShmNoDupMount oci_linux_test.go:29: assertion failed: error is not nil: mkdir /var/lib/docker: permission denied --- FAIL: TestTmpfsDevShmNoDupMount (0.00s) === RUN TestIpcPrivateVsReadonly oci_linux_test.go:29: assertion failed: error is not nil: mkdir /var/lib/docker: permission denied --- FAIL: TestIpcPrivateVsReadonly (0.00s) === RUN TestSysctlOverride oci_linux_test.go:29: assertion failed: error is not nil: mkdir /var/lib/docker: permission denied --- FAIL: TestSysctlOverride (0.00s) === RUN TestSysctlOverrideHost oci_linux_test.go:29: assertion failed: error is not nil: mkdir /var/lib/docker: permission denied --- FAIL: TestSysctlOverrideHost (0.00s) Signed-off-by: Arnaud Rebillout <elboulangero@gmail.com>
This commit is contained in:
parent
f1b882a603
commit
6349b32e1b
1 changed files with 5 additions and 0 deletions
|
@ -15,6 +15,7 @@ import (
|
||||||
"github.com/docker/libnetwork"
|
"github.com/docker/libnetwork"
|
||||||
"gotest.tools/v3/assert"
|
"gotest.tools/v3/assert"
|
||||||
is "gotest.tools/v3/assert/cmp"
|
is "gotest.tools/v3/assert/cmp"
|
||||||
|
"gotest.tools/v3/skip"
|
||||||
)
|
)
|
||||||
|
|
||||||
func setupFakeDaemon(t *testing.T, c *container.Container) *Daemon {
|
func setupFakeDaemon(t *testing.T, c *container.Container) *Daemon {
|
||||||
|
@ -62,6 +63,7 @@ func cleanupFakeContainer(c *container.Container) {
|
||||||
// in "Duplicate mount point" error from the engine.
|
// in "Duplicate mount point" error from the engine.
|
||||||
// https://github.com/moby/moby/issues/35455
|
// https://github.com/moby/moby/issues/35455
|
||||||
func TestTmpfsDevShmNoDupMount(t *testing.T) {
|
func TestTmpfsDevShmNoDupMount(t *testing.T) {
|
||||||
|
skip.If(t, os.Getuid() != 0, "skipping test that requires root")
|
||||||
c := &container.Container{
|
c := &container.Container{
|
||||||
ShmPath: "foobar", // non-empty, for c.IpcMounts() to work
|
ShmPath: "foobar", // non-empty, for c.IpcMounts() to work
|
||||||
HostConfig: &containertypes.HostConfig{
|
HostConfig: &containertypes.HostConfig{
|
||||||
|
@ -84,6 +86,7 @@ func TestTmpfsDevShmNoDupMount(t *testing.T) {
|
||||||
// the resulting /dev/shm mount is NOT made read-only.
|
// the resulting /dev/shm mount is NOT made read-only.
|
||||||
// https://github.com/moby/moby/issues/36503
|
// https://github.com/moby/moby/issues/36503
|
||||||
func TestIpcPrivateVsReadonly(t *testing.T) {
|
func TestIpcPrivateVsReadonly(t *testing.T) {
|
||||||
|
skip.If(t, os.Getuid() != 0, "skipping test that requires root")
|
||||||
c := &container.Container{
|
c := &container.Container{
|
||||||
HostConfig: &containertypes.HostConfig{
|
HostConfig: &containertypes.HostConfig{
|
||||||
IpcMode: containertypes.IpcMode("private"),
|
IpcMode: containertypes.IpcMode("private"),
|
||||||
|
@ -108,6 +111,7 @@ func TestIpcPrivateVsReadonly(t *testing.T) {
|
||||||
// TestSysctlOverride ensures that any implicit sysctls (such as
|
// TestSysctlOverride ensures that any implicit sysctls (such as
|
||||||
// Config.Domainname) are overridden by an explicit sysctl in the HostConfig.
|
// Config.Domainname) are overridden by an explicit sysctl in the HostConfig.
|
||||||
func TestSysctlOverride(t *testing.T) {
|
func TestSysctlOverride(t *testing.T) {
|
||||||
|
skip.If(t, os.Getuid() != 0, "skipping test that requires root")
|
||||||
c := &container.Container{
|
c := &container.Container{
|
||||||
Config: &containertypes.Config{
|
Config: &containertypes.Config{
|
||||||
Hostname: "foobar",
|
Hostname: "foobar",
|
||||||
|
@ -149,6 +153,7 @@ func TestSysctlOverride(t *testing.T) {
|
||||||
// TestSysctlOverrideHost ensures that any implicit network sysctls are not set
|
// TestSysctlOverrideHost ensures that any implicit network sysctls are not set
|
||||||
// with host networking
|
// with host networking
|
||||||
func TestSysctlOverrideHost(t *testing.T) {
|
func TestSysctlOverrideHost(t *testing.T) {
|
||||||
|
skip.If(t, os.Getuid() != 0, "skipping test that requires root")
|
||||||
c := &container.Container{
|
c := &container.Container{
|
||||||
Config: &containertypes.Config{},
|
Config: &containertypes.Config{},
|
||||||
HostConfig: &containertypes.HostConfig{
|
HostConfig: &containertypes.HostConfig{
|
||||||
|
|
Loading…
Reference in a new issue