From 78798cab004f1970e8c230aea1614e78dcdde4b5 Mon Sep 17 00:00:00 2001 From: Brent Baude Date: Tue, 7 Nov 2023 13:16:39 -0600 Subject: [PATCH] Automatic code cleanups - JetBrains A bunch of cleanups as suggested by linters/etc in JetBrains IDE. Signed-off-by: Brent Baude --- cmd/podman/common/create_test.go | 6 ++-- cmd/podman/containers/restore.go | 2 +- cmd/podman/containers/stats.go | 2 +- libpod/container_inspect.go | 2 +- pkg/api/handlers/compat/containers.go | 2 +- pkg/bindings/test/images_test.go | 2 +- pkg/bindings/test/pods_test.go | 10 +++--- pkg/domain/infra/abi/farm.go | 2 +- pkg/domain/infra/abi/images.go | 2 +- pkg/domain/infra/abi/parse/parse.go | 2 +- .../apimachinery/pkg/api/resource/amount.go | 2 +- .../apimachinery/pkg/api/resource/math.go | 2 +- .../apimachinery/pkg/api/resource/quantity.go | 2 +- pkg/machine/e2e/config_test.go | 2 +- pkg/machine/e2e/machine_test.go | 2 +- pkg/machine/e2e/stop_test.go | 2 +- pkg/machine/fcos.go | 2 +- pkg/specgen/generate/container_create.go | 2 +- pkg/specgen/generate/kube/kube.go | 8 ++--- test/e2e/containers_conf_test.go | 2 +- test/e2e/healthcheck_run_test.go | 2 +- test/e2e/play_build_test.go | 12 +++---- test/e2e/play_kube_test.go | 12 +++---- test/e2e/pod_infra_container_test.go | 2 +- test/e2e/run_device_test.go | 2 +- test/e2e/run_passwd_test.go | 2 +- test/e2e/run_test.go | 4 +-- test/e2e/toolbox_test.go | 32 +++++++++---------- 28 files changed, 63 insertions(+), 63 deletions(-) diff --git a/cmd/podman/common/create_test.go b/cmd/podman/common/create_test.go index 80e6cbf54a..c31f214bf1 100644 --- a/cmd/podman/common/create_test.go +++ b/cmd/podman/common/create_test.go @@ -39,11 +39,11 @@ func TestPodOptions(t *testing.T) { areEqual = podField.Interface().([]string)[i] == w } case reflect.String: - areEqual = (podField.String() == containerField.String()) + areEqual = podField.String() == containerField.String() case reflect.Bool: - areEqual = (podField.Bool() == containerField.Bool()) + areEqual = podField.Bool() == containerField.Bool() case reflect.Ptr: - areEqual = (reflect.DeepEqual(podField.Elem().Interface(), containerField.Elem().Interface())) + areEqual = reflect.DeepEqual(podField.Elem().Interface(), containerField.Elem().Interface()) } } assert.True(t, areEqual) diff --git a/cmd/podman/containers/restore.go b/cmd/podman/containers/restore.go index 949eccede0..2f1458df60 100644 --- a/cmd/podman/containers/restore.go +++ b/cmd/podman/containers/restore.go @@ -123,7 +123,7 @@ func restore(cmd *cobra.Command, args []string) error { } } - notImport := (!restoreOptions.CheckpointImage && restoreOptions.Import == "") + notImport := !restoreOptions.CheckpointImage && restoreOptions.Import == "" if notImport && restoreOptions.ImportPrevious != "" { return fmt.Errorf("--import-previous can only be used with image or --import") diff --git a/cmd/podman/containers/stats.go b/cmd/podman/containers/stats.go index cdf1928ab8..ed462a7af6 100644 --- a/cmd/podman/containers/stats.go +++ b/cmd/podman/containers/stats.go @@ -207,7 +207,7 @@ func (s *containerStats) AVGCPU() string { } func (s *containerStats) Up() string { - return (s.UpTime.String()) + return s.UpTime.String() } func (s *containerStats) MemPerc() string { diff --git a/libpod/container_inspect.go b/libpod/container_inspect.go index d968fa00b1..d823c7749d 100644 --- a/libpod/container_inspect.go +++ b/libpod/container_inspect.go @@ -12,7 +12,7 @@ import ( "github.com/containers/podman/v4/libpod/driver" "github.com/containers/podman/v4/pkg/util" "github.com/containers/storage/types" - units "github.com/docker/go-units" + "github.com/docker/go-units" spec "github.com/opencontainers/runtime-spec/specs-go" "github.com/sirupsen/logrus" ) diff --git a/pkg/api/handlers/compat/containers.go b/pkg/api/handlers/compat/containers.go index c24a3eb644..32a8024ed2 100644 --- a/pkg/api/handlers/compat/containers.go +++ b/pkg/api/handlers/compat/containers.go @@ -120,7 +120,7 @@ func ListContainers(w http.ResponseWriter, r *http.Request) { filterFuncs := make([]libpod.ContainerFilter, 0, len(*filterMap)) all := query.All || query.Limit > 0 - if len((*filterMap)) > 0 { + if len(*filterMap) > 0 { for k, v := range *filterMap { generatedFunc, err := filters.GenerateContainerFilterFuncs(k, v, runtime) if err != nil { diff --git a/pkg/bindings/test/images_test.go b/pkg/bindings/test/images_test.go index 06c939c8f1..43496bfa97 100644 --- a/pkg/bindings/test/images_test.go +++ b/pkg/bindings/test/images_test.go @@ -112,7 +112,7 @@ var _ = Describe("Podman images", func() { Expect(code).To(BeNumerically("==", http.StatusNotFound)) // Start a container with alpine image - var top string = "top" + var top = "top" _, err = bt.RunTopContainer(&top, nil) Expect(err).ToNot(HaveOccurred()) // we should now have a container called "top" running diff --git a/pkg/bindings/test/pods_test.go b/pkg/bindings/test/pods_test.go index d9378417ee..8627877d1e 100644 --- a/pkg/bindings/test/pods_test.go +++ b/pkg/bindings/test/pods_test.go @@ -76,7 +76,7 @@ var _ = Describe("Podman pods", func() { Expect(podSummary[0].Containers).To(HaveLen(2)) // Add multiple pods and verify them by name and size. - var newpod2 string = "newpod2" + var newpod2 = "newpod2" bt.Podcreate(&newpod2) podSummary, err = pods.List(bt.conn, nil) Expect(err).ToNot(HaveOccurred(), "Error from pods.List") @@ -218,7 +218,7 @@ var _ = Describe("Podman pods", func() { Expect(err).ToNot(HaveOccurred()) portPublish := fmt.Sprintf("%d:%d", randomport, randomport) - var podwithport string = "newpodwithport" + var podwithport = "newpodwithport" bt.PodcreateAndExpose(&podwithport, &portPublish) // Start pod and expose port 12345 @@ -226,7 +226,7 @@ var _ = Describe("Podman pods", func() { Expect(err).ToNot(HaveOccurred()) // Start another pod and expose same port 12345 - var podwithport2 string = "newpodwithport2" + var podwithport2 = "newpodwithport2" bt.PodcreateAndExpose(&podwithport2, &portPublish) _, err = pods.Start(bt.conn, podwithport2, nil) @@ -298,7 +298,7 @@ var _ = Describe("Podman pods", func() { // Test to validate all the pods in the stopped/exited state are pruned successfully. It("prune pod", func() { // Add a new pod - var newpod2 string = "newpod2" + var newpod2 = "newpod2" bt.Podcreate(&newpod2) // No pods pruned since no pod in exited state pruneResponse, err := pods.Prune(bt.conn, nil) @@ -376,7 +376,7 @@ var _ = Describe("Podman pods", func() { // Test validates the pod top bindings It("pod top", func() { - var name string = "podA" + var name = "podA" bt.Podcreate(&name) _, err := pods.Start(bt.conn, name, nil) diff --git a/pkg/domain/infra/abi/farm.go b/pkg/domain/infra/abi/farm.go index c893cb6cb7..b89b88d445 100644 --- a/pkg/domain/infra/abi/farm.go +++ b/pkg/domain/infra/abi/farm.go @@ -40,7 +40,7 @@ func (ir *ImageEngine) fetchInfo(_ context.Context) (os, arch, variant string, n os, arch, variant = lplatform.Normalize(os, arch, variant) nativePlatform = os + "/" + arch if variant != "" { - nativePlatform += ("/" + variant) + nativePlatform += "/" + variant } emulatedPlatforms = emulation.Registered() return os, arch, variant, append([]string{}, nativePlatform), emulatedPlatforms, nil diff --git a/pkg/domain/infra/abi/images.go b/pkg/domain/infra/abi/images.go index 5deed22b06..16b2f92c11 100644 --- a/pkg/domain/infra/abi/images.go +++ b/pkg/domain/infra/abi/images.go @@ -845,7 +845,7 @@ func transferRootful(source entities.ImageScpOptions, dest entities.ImageScpOpti if err != nil { return err } - out, err := execTransferPodman(uLoad, loadCommand, (len(dest.Tag) > 0)) + out, err := execTransferPodman(uLoad, loadCommand, len(dest.Tag) > 0) if err != nil { return err } diff --git a/pkg/domain/infra/abi/parse/parse.go b/pkg/domain/infra/abi/parse/parse.go index fb2876bb26..0cb95aa042 100644 --- a/pkg/domain/infra/abi/parse/parse.go +++ b/pkg/domain/infra/abi/parse/parse.go @@ -7,7 +7,7 @@ import ( "github.com/containers/podman/v4/libpod" "github.com/containers/podman/v4/libpod/define" - units "github.com/docker/go-units" + "github.com/docker/go-units" "github.com/sirupsen/logrus" ) diff --git a/pkg/k8s.io/apimachinery/pkg/api/resource/amount.go b/pkg/k8s.io/apimachinery/pkg/api/resource/amount.go index 69613321f6..fbe162b1b0 100644 --- a/pkg/k8s.io/apimachinery/pkg/api/resource/amount.go +++ b/pkg/k8s.io/apimachinery/pkg/api/resource/amount.go @@ -20,7 +20,7 @@ import ( "math/big" "strconv" - inf "gopkg.in/inf.v0" + "gopkg.in/inf.v0" ) // Scale is used for getting and setting the base-10 scaled value. diff --git a/pkg/k8s.io/apimachinery/pkg/api/resource/math.go b/pkg/k8s.io/apimachinery/pkg/api/resource/math.go index 59a4c14de1..df17e605d8 100644 --- a/pkg/k8s.io/apimachinery/pkg/api/resource/math.go +++ b/pkg/k8s.io/apimachinery/pkg/api/resource/math.go @@ -19,7 +19,7 @@ package resource import ( "math/big" - inf "gopkg.in/inf.v0" + "gopkg.in/inf.v0" ) const ( diff --git a/pkg/k8s.io/apimachinery/pkg/api/resource/quantity.go b/pkg/k8s.io/apimachinery/pkg/api/resource/quantity.go index 57a177f94d..32ef1af089 100644 --- a/pkg/k8s.io/apimachinery/pkg/api/resource/quantity.go +++ b/pkg/k8s.io/apimachinery/pkg/api/resource/quantity.go @@ -25,7 +25,7 @@ import ( "strconv" "strings" - inf "gopkg.in/inf.v0" + "gopkg.in/inf.v0" ) // Quantity is a fixed-point representation of a number. diff --git a/pkg/machine/e2e/config_test.go b/pkg/machine/e2e/config_test.go index 50ed7da5e5..a77c22652e 100644 --- a/pkg/machine/e2e/config_test.go +++ b/pkg/machine/e2e/config_test.go @@ -22,7 +22,7 @@ import ( var originalHomeDir = os.Getenv("HOME") const ( - defaultTimeout time.Duration = 90 * time.Second + defaultTimeout = 90 * time.Second ) type machineCommand interface { diff --git a/pkg/machine/e2e/machine_test.go b/pkg/machine/e2e/machine_test.go index fd70eccfe8..c7400d2040 100644 --- a/pkg/machine/e2e/machine_test.go +++ b/pkg/machine/e2e/machine_test.go @@ -25,7 +25,7 @@ func TestMain(m *testing.M) { } const ( - defaultStream machine.FCOSStream = machine.Testing + defaultStream = machine.Testing ) var ( diff --git a/pkg/machine/e2e/stop_test.go b/pkg/machine/e2e/stop_test.go index 2bac773567..11c308e51b 100644 --- a/pkg/machine/e2e/stop_test.go +++ b/pkg/machine/e2e/stop_test.go @@ -46,7 +46,7 @@ var _ = Describe("podman machine stop", func() { // Stopping it again should not result in an error stopAgain, err := mb.setCmd(stop).run() Expect(err).ToNot(HaveOccurred()) - Expect(stopAgain).To(Exit((0))) + Expect(stopAgain).To(Exit(0)) Expect(stopAgain.outputToString()).To(ContainSubstring(fmt.Sprintf("Machine \"%s\" stopped successfully", name))) // Stopping a machine should update the last up time diff --git a/pkg/machine/fcos.go b/pkg/machine/fcos.go index cf90c88608..6f46379f0b 100644 --- a/pkg/machine/fcos.go +++ b/pkg/machine/fcos.go @@ -18,7 +18,7 @@ import ( "github.com/coreos/stream-metadata-go/fedoracoreos" "github.com/coreos/stream-metadata-go/release" "github.com/coreos/stream-metadata-go/stream" - digest "github.com/opencontainers/go-digest" + "github.com/opencontainers/go-digest" "github.com/sirupsen/logrus" ) diff --git a/pkg/specgen/generate/container_create.go b/pkg/specgen/generate/container_create.go index c8f3f318a3..940fefae08 100644 --- a/pkg/specgen/generate/container_create.go +++ b/pkg/specgen/generate/container_create.go @@ -232,7 +232,7 @@ func MakeContainer(ctx context.Context, rt *libpod.Runtime, s *specgen.SpecGener return nil, nil, nil, err } - infraVol := (len(compatibleOptions.Mounts) > 0 || len(compatibleOptions.Volumes) > 0 || len(compatibleOptions.ImageVolumes) > 0 || len(compatibleOptions.OverlayVolumes) > 0) + infraVol := len(compatibleOptions.Mounts) > 0 || len(compatibleOptions.Volumes) > 0 || len(compatibleOptions.ImageVolumes) > 0 || len(compatibleOptions.OverlayVolumes) > 0 opts, err := createContainerOptions(rt, s, pod, finalVolumes, finalOverlays, imageData, command, infraVol, *compatibleOptions) if err != nil { return nil, nil, nil, err diff --git a/pkg/specgen/generate/kube/kube.go b/pkg/specgen/generate/kube/kube.go index 5bb135d19f..cebf3e5d13 100644 --- a/pkg/specgen/generate/kube/kube.go +++ b/pkg/specgen/generate/kube/kube.go @@ -589,7 +589,7 @@ func ToSpecGen(ctx context.Context, opts *CtrSpecGenOptions) (*specgen.SpecGener } if ro := opts.ReadOnly; ro != itypes.OptionalBoolUndefined { - s.ReadOnlyFilesystem = (ro == itypes.OptionalBoolTrue) + s.ReadOnlyFilesystem = ro == itypes.OptionalBoolTrue } // This should default to true for kubernetes yaml s.ReadWriteTmpfs = true @@ -785,7 +785,7 @@ func makeHealthCheck(inCmd string, interval int32, retries int32, timeout int32, // kubernetes interval defaults to 10 sec and cannot be less than 1 interval = 10 } - hc.Interval = (time.Duration(interval) * time.Second) + hc.Interval = time.Duration(interval) * time.Second if retries < 1 { // kubernetes retries defaults to 3 retries = 3 @@ -795,13 +795,13 @@ func makeHealthCheck(inCmd string, interval int32, retries int32, timeout int32, // kubernetes timeout defaults to 1 timeout = 1 } - timeoutDuration := (time.Duration(timeout) * time.Second) + timeoutDuration := time.Duration(timeout) * time.Second if timeoutDuration < time.Duration(1) { return nil, errors.New("healthcheck-timeout must be at least 1 second") } hc.Timeout = timeoutDuration - startPeriodDuration := (time.Duration(startPeriod) * time.Second) + startPeriodDuration := time.Duration(startPeriod) * time.Second if startPeriodDuration < time.Duration(0) { return nil, errors.New("healthcheck-start-period must be 0 seconds or greater") } diff --git a/test/e2e/containers_conf_test.go b/test/e2e/containers_conf_test.go index fdee8ce1aa..8360c79117 100644 --- a/test/e2e/containers_conf_test.go +++ b/test/e2e/containers_conf_test.go @@ -292,7 +292,7 @@ var _ = Describe("Verify podman containers.conf usage", func() { session = podmanTest.Podman([]string{"run", "--rm", "--net", "host", fedoraMinimal, "cat", "/proc/sys/net/ipv4/ping_group_range"}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) - Expect(session.OutputToString()).ToNot((ContainSubstring("1000"))) + Expect(session.OutputToString()).ToNot(ContainSubstring("1000")) }) It("search domain", func() { diff --git a/test/e2e/healthcheck_run_test.go b/test/e2e/healthcheck_run_test.go index 8aafd78625..bd09a2074d 100644 --- a/test/e2e/healthcheck_run_test.go +++ b/test/e2e/healthcheck_run_test.go @@ -6,7 +6,7 @@ import ( "path/filepath" "time" - define "github.com/containers/podman/v4/libpod/define" + "github.com/containers/podman/v4/libpod/define" . "github.com/containers/podman/v4/test/utils" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" diff --git a/test/e2e/play_build_test.go b/test/e2e/play_build_test.go index b416d8275d..7e18fcb7c5 100644 --- a/test/e2e/play_build_test.go +++ b/test/e2e/play_build_test.go @@ -81,7 +81,7 @@ LABEL marge=mom cwd, err := os.Getwd() Expect(err).ToNot(HaveOccurred()) Expect(os.Chdir(yamlDir)).To(Succeed()) - defer func() { (Expect(os.Chdir(cwd)).To(BeNil())) }() + defer func() { Expect(os.Chdir(cwd)).To(Succeed()) }() session := podmanTest.Podman([]string{"kube", "play", "top.yaml"}) session.WaitWithDefaultTimeout() @@ -118,7 +118,7 @@ LABEL marge=mom cwd, err := os.Getwd() Expect(err).ToNot(HaveOccurred()) Expect(os.Chdir(yamlDir)).To(Succeed()) - defer func() { (Expect(os.Chdir(cwd)).To(BeNil())) }() + defer func() { Expect(os.Chdir(cwd)).To(Succeed()) }() session := podmanTest.Podman([]string{"kube", "play", "top.yaml"}) session.WaitWithDefaultTimeout() @@ -163,7 +163,7 @@ LABEL marge=mom cwd, err := os.Getwd() Expect(err).ToNot(HaveOccurred()) Expect(os.Chdir(yamlDir)).To(Succeed()) - defer func() { (Expect(os.Chdir(cwd)).To(BeNil())) }() + defer func() { Expect(os.Chdir(cwd)).To(Succeed()) }() // Build the image into the local store build := podmanTest.Podman([]string{"build", "-t", "foobar", "-f", "Containerfile"}) @@ -210,7 +210,7 @@ LABEL marge=mom cwd, err := os.Getwd() Expect(err).ToNot(HaveOccurred()) Expect(os.Chdir(yamlDir)).To(Succeed()) - defer func() { (Expect(os.Chdir(cwd)).To(BeNil())) }() + defer func() { Expect(os.Chdir(cwd)).To(Succeed()) }() // Build the image into the local store build := podmanTest.Podman([]string{"build", "-t", "foobar", "-f", "Containerfile"}) @@ -257,7 +257,7 @@ LABEL marge=mom cwd, err := os.Getwd() Expect(err).ToNot(HaveOccurred()) Expect(os.Chdir(yamlDir)).To(Succeed()) - defer func() { (Expect(os.Chdir(cwd)).To(BeNil())) }() + defer func() { Expect(os.Chdir(cwd)).To(Succeed()) }() // Build the image into the local store build := podmanTest.Podman([]string{"build", "-t", "foobar", "-f", "Containerfile"}) @@ -347,7 +347,7 @@ echo GOT-HERE cwd, err := os.Getwd() Expect(err).ToNot(HaveOccurred()) Expect(os.Chdir(yamlDir)).To(Succeed()) - defer func() { (Expect(os.Chdir(cwd)).To(BeNil())) }() + defer func() { Expect(os.Chdir(cwd)).To(Succeed()) }() session := podmanTest.Podman([]string{"kube", "play", "echo.yaml"}) session.WaitWithDefaultTimeout() diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go index c936890c2f..77aed75e86 100644 --- a/test/e2e/play_kube_test.go +++ b/test/e2e/play_kube_test.go @@ -3820,11 +3820,11 @@ spec: podmanTest.CgroupManager = "systemd" var ( - numReplicas int32 = 3 - expectedCPURequest string = "100m" - expectedCPULimit string = "200m" - expectedMemoryRequest string = "10000000" - expectedMemoryLimit string = "20000000" + numReplicas int32 = 3 + expectedCPURequest = "100m" + expectedCPULimit = "200m" + expectedMemoryRequest = "10000000" + expectedMemoryLimit = "20000000" ) expectedCPUQuota := milliCPUToQuota(expectedCPULimit) @@ -3869,7 +3869,7 @@ MemoryReservation: {{ .HostConfig.MemoryReservation }}`}) podmanTest.CgroupManager = "systemd" var ( - expectedCPULimit string = "1" + expectedCPULimit = "1" ) deployment := getDeployment( diff --git a/test/e2e/pod_infra_container_test.go b/test/e2e/pod_infra_container_test.go index e8aea0a5b2..91bebaa53d 100644 --- a/test/e2e/pod_infra_container_test.go +++ b/test/e2e/pod_infra_container_test.go @@ -424,7 +424,7 @@ var _ = Describe("Podman pod create", func() { session = podmanTest.Podman([]string{"pod", "inspect", "--format", "{{.NumContainers}}", session.OutputToString()}) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) - Expect(session.OutputToString()).Should((Equal("0"))) + Expect(session.OutputToString()).Should(Equal("0")) }) } diff --git a/test/e2e/run_device_test.go b/test/e2e/run_device_test.go index bf97f2273d..f856a41a35 100644 --- a/test/e2e/run_device_test.go +++ b/test/e2e/run_device_test.go @@ -94,7 +94,7 @@ var _ = Describe("Podman run device", func() { // verify --privileged is required session2 := podmanTest.Podman([]string{"run", ALPINE, "test", "-c", "/dev/kmsg"}) session2.WaitWithDefaultTimeout() - Expect(session2).Should((Exit(1))) + Expect(session2).Should(Exit(1)) }) It("podman run CDI device test", func() { diff --git a/test/e2e/run_passwd_test.go b/test/e2e/run_passwd_test.go index 576423815c..538f95078e 100644 --- a/test/e2e/run_passwd_test.go +++ b/test/e2e/run_passwd_test.go @@ -116,7 +116,7 @@ USER 1000`, ALPINE) run = podmanTest.Podman([]string{"run", "--passwd=false", "--user", "1234:1234", ALPINE, "cat", "/etc/passwd"}) run.WaitWithDefaultTimeout() Expect(run).Should(ExitCleanly()) - Expect(run.OutputToString()).NotTo((ContainSubstring("1234:1234"))) + Expect(run.OutputToString()).NotTo(ContainSubstring("1234:1234")) }) It("podman run --passwd-entry flag", func() { diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index df3572a915..75f40f4227 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -1584,7 +1584,7 @@ VOLUME %s`, ALPINE, volPath, volPath) curCgroupsBytes, err := os.ReadFile("/proc/self/cgroup") Expect(err).ToNot(HaveOccurred()) - var curCgroups string = string(curCgroupsBytes) + var curCgroups = string(curCgroupsBytes) GinkgoWriter.Printf("Output:\n%s\n", curCgroups) Expect(curCgroups).To(Not(Equal(""))) @@ -1601,7 +1601,7 @@ VOLUME %s`, ALPINE, volPath, volPath) ctrCgroupsBytes, err := os.ReadFile(fmt.Sprintf("/proc/%d/cgroup", pid)) Expect(err).ToNot(HaveOccurred()) - var ctrCgroups string = string(ctrCgroupsBytes) + var ctrCgroups = string(ctrCgroupsBytes) GinkgoWriter.Printf("Output\n:%s\n", ctrCgroups) Expect(curCgroups).To(Not(Equal(ctrCgroups))) }) diff --git a/test/e2e/toolbox_test.go b/test/e2e/toolbox_test.go index 4f36f042b7..b917d5751a 100644 --- a/test/e2e/toolbox_test.go +++ b/test/e2e/toolbox_test.go @@ -182,11 +182,11 @@ var _ = Describe("Toolbox-specific testing", func() { SkipIfNotRootless("only meaningful when run rootless") var session *PodmanSessionIntegration - var username string = "testuser" - var homeDir string = "/home/testuser" - var shell string = "/bin/sh" - var uid string = "1001" - var gid string = "1001" + var username = "testuser" + var homeDir = "/home/testuser" + var shell = "/bin/sh" + var uid = "1001" + var gid = "1001" useradd := fmt.Sprintf("useradd --home-dir %s --shell %s --uid %s %s", homeDir, shell, uid, username) @@ -222,8 +222,8 @@ var _ = Describe("Toolbox-specific testing", func() { SkipIfNotRootless("only meaningful when run rootless") var session *PodmanSessionIntegration - var groupName string = "testgroup" - var gid string = "1001" + var groupName = "testgroup" + var gid = "1001" groupadd := fmt.Sprintf("groupadd --gid %s %s", gid, groupName) @@ -252,15 +252,15 @@ var _ = Describe("Toolbox-specific testing", func() { It("podman create --userns=keep-id - entrypoint - modifying existing user with usermod - add to new group, change home/shell/uid", func() { SkipIfNotRootless("only meaningful when run rootless") var session *PodmanSessionIntegration - var badHomeDir string = "/home/badtestuser" - var badShell string = "/bin/sh" - var badUID string = "1001" - var username string = "testuser" - var homeDir string = "/home/testuser" - var shell string = "/bin/bash" - var uid string = "1411" - var groupName string = "testgroup" - var gid string = "1422" + var badHomeDir = "/home/badtestuser" + var badShell = "/bin/sh" + var badUID = "1001" + var username = "testuser" + var homeDir = "/home/testuser" + var shell = "/bin/bash" + var uid = "1411" + var groupName = "testgroup" + var gid = "1422" // The use of bad* in the name of variables does not imply the invocation // of useradd should fail The user is supposed to be created successfully