diff --git a/integration/container/copy_test.go b/integration/container/copy_test.go index 2ec51d89afb9b59a56f96af4b6c2067a9180b617..8872aeda3000bade72bda45751b65fb980983a73 100644 --- a/integration/container/copy_test.go +++ b/integration/container/copy_test.go @@ -95,7 +95,7 @@ func TestCopyEmptyFile(t *testing.T) { func makeEmptyArchive(t *testing.T) (string, io.ReadCloser) { tmpDir := t.TempDir() srcPath := filepath.Join(tmpDir, "empty-file.txt") - err := os.WriteFile(srcPath, []byte(""), 0400) + err := os.WriteFile(srcPath, []byte(""), 0o400) assert.NilError(t, err) // TODO(thaJeztah) Add utilities to the client to make steps below less complicated. diff --git a/integration/container/create_test.go b/integration/container/create_test.go index c83af007d101a09841f8674ea104313b88ec25a1..2c8f949768087ca1952f0fe1cf896f8e532cd7da 100644 --- a/integration/container/create_test.go +++ b/integration/container/create_test.go @@ -176,6 +176,7 @@ func TestCreateTmpfsMountsTarget(t *testing.T) { assert.Check(t, errdefs.IsInvalidParameter(err)) } } + func TestCreateWithCustomMaskedPaths(t *testing.T) { skip.If(t, testEnv.DaemonInfo.OSType != "linux") diff --git a/integration/container/devices_windows_test.go b/integration/container/devices_windows_test.go index 1ab5c6e690fcb93f2d1fcab3bcda46182b25a5da..7216f22adbc67fe639ccd23e50bd4efede0c97a1 100644 --- a/integration/container/devices_windows_test.go +++ b/integration/container/devices_windows_test.go @@ -114,15 +114,16 @@ func TestWindowsDevices(t *testing.T) { // /Windows/System32/HostDriverStore is mounted from the host when class GUID 5B45201D-F2F2-4F3B-85BB-30FF1F953599 // is mounted. See `C:\windows\System32\containers\devices.def` on a Windows host for (slightly more) details. - res, err := container.Exec(ctx, client, id, []string{"sh", "-c", - "ls -d /Windows/System32/HostDriverStore/* | grep /Windows/System32/HostDriverStore/FileRepository"}) + res, err := container.Exec(ctx, client, id, []string{ + "sh", "-c", + "ls -d /Windows/System32/HostDriverStore/* | grep /Windows/System32/HostDriverStore/FileRepository", + }) assert.NilError(t, err) assert.Equal(t, d.expectedExitCode, res.ExitCode) if d.expectedExitCode == 0 { assert.Equal(t, d.expectedStdout, strings.TrimSpace(res.Stdout())) assert.Equal(t, d.expectedStderr, strings.TrimSpace(res.Stderr())) } - }) } } diff --git a/integration/container/mounts_linux_test.go b/integration/container/mounts_linux_test.go index 1627d76bc6b69493b0c251e579b5d950f559ba7d..26f0eaad4327dfac18b1040abfa9685bb872f864 100644 --- a/integration/container/mounts_linux_test.go +++ b/integration/container/mounts_linux_test.go @@ -34,7 +34,7 @@ func TestContainerNetworkMountsNoChown(t *testing.T) { ctx := context.Background() - tmpDir := fs.NewDir(t, "network-file-mounts", fs.WithMode(0755), fs.WithFile("nwfile", "network file bind mount", fs.WithMode(0644))) + tmpDir := fs.NewDir(t, "network-file-mounts", fs.WithMode(0o755), fs.WithFile("nwfile", "network file bind mount", fs.WithMode(0o644))) defer tmpDir.Remove() tmpNWFileMount := tmpDir.Join("nwfile") @@ -179,7 +179,6 @@ func TestMountDaemonRoot(t *testing.T) { Image: "busybox", Cmd: []string{"true"}, }, hc, nil, nil, "") - if err != nil { if test.expected != "" { t.Fatal(err) @@ -222,12 +221,12 @@ func TestContainerBindMountNonRecursive(t *testing.T) { defer setupTest(t)() - tmpDir1 := fs.NewDir(t, "tmpdir1", fs.WithMode(0755), - fs.WithDir("mnt", fs.WithMode(0755))) + tmpDir1 := fs.NewDir(t, "tmpdir1", fs.WithMode(0o755), + fs.WithDir("mnt", fs.WithMode(0o755))) defer tmpDir1.Remove() tmpDir1Mnt := filepath.Join(tmpDir1.Path(), "mnt") - tmpDir2 := fs.NewDir(t, "tmpdir2", fs.WithMode(0755), - fs.WithFile("file", "should not be visible when NonRecursive", fs.WithMode(0644))) + tmpDir2 := fs.NewDir(t, "tmpdir2", fs.WithMode(0o755), + fs.WithFile("file", "should not be visible when NonRecursive", fs.WithMode(0o644))) defer tmpDir2.Remove() err := mount.Mount(tmpDir2.Path(), tmpDir1Mnt, "none", "bind,ro") @@ -281,8 +280,8 @@ func TestContainerVolumesMountedAsShared(t *testing.T) { defer setupTest(t)() // Prepare a source directory to bind mount - tmpDir1 := fs.NewDir(t, "volume-source", fs.WithMode(0755), - fs.WithDir("mnt1", fs.WithMode(0755))) + tmpDir1 := fs.NewDir(t, "volume-source", fs.WithMode(0o755), + fs.WithDir("mnt1", fs.WithMode(0o755))) defer tmpDir1.Remove() tmpDir1Mnt := filepath.Join(tmpDir1.Path(), "mnt1") @@ -332,15 +331,15 @@ func TestContainerVolumesMountedAsSlave(t *testing.T) { skip.If(t, testEnv.IsRootless, "cannot be tested because RootlessKit executes the daemon in private mount namespace (https://github.com/rootless-containers/rootlesskit/issues/97)") // Prepare a source directory to bind mount - tmpDir1 := fs.NewDir(t, "volume-source", fs.WithMode(0755), - fs.WithDir("mnt1", fs.WithMode(0755))) + tmpDir1 := fs.NewDir(t, "volume-source", fs.WithMode(0o755), + fs.WithDir("mnt1", fs.WithMode(0o755))) defer tmpDir1.Remove() tmpDir1Mnt := filepath.Join(tmpDir1.Path(), "mnt1") // Prepare a source directory with file in it. We will bind mount this // directory and see if file shows up. - tmpDir2 := fs.NewDir(t, "volume-source2", fs.WithMode(0755), - fs.WithFile("slave-testfile", "Test", fs.WithMode(0644))) + tmpDir2 := fs.NewDir(t, "volume-source2", fs.WithMode(0o755), + fs.WithFile("slave-testfile", "Test", fs.WithMode(0o644))) defer tmpDir2.Remove() // Convert this directory into a shared mount point so that we do diff --git a/integration/container/remove_test.go b/integration/container/remove_test.go index af3014f1e5406fec04ab1060ba9d31b92e498021..18c4819c041e598c99a9208403239aa9e5eb6b74 100644 --- a/integration/container/remove_test.go +++ b/integration/container/remove_test.go @@ -34,7 +34,7 @@ func TestRemoveContainerWithRemovedVolume(t *testing.T) { prefix, slash := getPrefixAndSlashFromDaemonPlatform() - tempDir := fs.NewDir(t, "test-rm-container-with-removed-volume", fs.WithMode(0755)) + tempDir := fs.NewDir(t, "test-rm-container-with-removed-volume", fs.WithMode(0o755)) defer tempDir.Remove() cID := container.Run(ctx, t, client, container.WithCmd("true"), container.WithBind(tempDir.Path(), prefix+slash+"test")) diff --git a/integration/container/restart_test.go b/integration/container/restart_test.go index 3a6155003a59d76105245c8650898dd78aefc8fb..dfb5aa73133ba9f2c8736ed2d0cd96180f1b13f2 100644 --- a/integration/container/restart_test.go +++ b/integration/container/restart_test.go @@ -48,7 +48,8 @@ func TestDaemonRestartKillContainers(t *testing.T) { }, { desc: "container with restart=always and with healthcheck", - config: &container.Config{Image: "busybox", Cmd: []string{"top"}, + config: &container.Config{ + Image: "busybox", Cmd: []string{"top"}, Healthcheck: &container.HealthConfig{ Test: []string{"CMD-SHELL", "sleep 1"}, Interval: time.Second, diff --git a/integration/container/run_linux_test.go b/integration/container/run_linux_test.go index 6a8322d9d8b6488cf49cb922c91cee5859202aad..96b6fe895e639e4e1c546bae14e956ac6bdbe202 100644 --- a/integration/container/run_linux_test.go +++ b/integration/container/run_linux_test.go @@ -155,15 +155,15 @@ func TestPrivilegedHostDevices(t *testing.T) { ) // Create Null devices. - if err := system.Mknod(devTest, unix.S_IFCHR|0600, int(system.Mkdev(1, 3))); err != nil { + if err := system.Mknod(devTest, unix.S_IFCHR|0o600, int(system.Mkdev(1, 3))); err != nil { t.Fatal(err) } defer os.Remove(devTest) - if err := os.Mkdir(filepath.Dir(devRootOnlyTest), 0700); err != nil { + if err := os.Mkdir(filepath.Dir(devRootOnlyTest), 0o700); err != nil { t.Fatal(err) } defer os.RemoveAll(filepath.Dir(devRootOnlyTest)) - if err := system.Mknod(devRootOnlyTest, unix.S_IFCHR|0600, int(system.Mkdev(1, 3))); err != nil { + if err := system.Mknod(devRootOnlyTest, unix.S_IFCHR|0o600, int(system.Mkdev(1, 3))); err != nil { t.Fatal(err) } defer os.Remove(devRootOnlyTest) @@ -238,7 +238,7 @@ func TestRunWithAlternativeContainerdShim(t *testing.T) { t.Errorf("shimDir RemoveAll cleanup: %v", err) } }) - assert.Assert(t, os.Chmod(shimDir, 0777)) + assert.Assert(t, os.Chmod(shimDir, 0o777)) shimDir, err = filepath.Abs(shimDir) assert.Assert(t, err) assert.Assert(t, os.Symlink(realShimPath, filepath.Join(shimDir, "containerd-shim-realfake-v42")))