summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.golangci.yml1
-rw-r--r--pkg/bindings/test/attach_test.go2
-rw-r--r--pkg/bindings/test/auth_test.go2
-rw-r--r--pkg/bindings/test/common_test.go4
-rw-r--r--pkg/bindings/test/connection_test.go2
-rw-r--r--pkg/bindings/test/containers_test.go3
-rw-r--r--pkg/bindings/test/create_test.go2
-rw-r--r--pkg/bindings/test/exec_test.go2
-rw-r--r--pkg/bindings/test/generator_test.go2
-rw-r--r--pkg/bindings/test/images_test.go13
-rw-r--r--pkg/bindings/test/info_test.go2
-rw-r--r--pkg/bindings/test/manifests_test.go2
-rw-r--r--pkg/bindings/test/networks_test.go2
-rw-r--r--pkg/bindings/test/pods_test.go6
-rw-r--r--pkg/bindings/test/resource_test.go2
-rw-r--r--pkg/bindings/test/secrets_test.go2
-rw-r--r--pkg/bindings/test/system_test.go2
-rw-r--r--pkg/bindings/test/test_suite_test.go2
-rw-r--r--pkg/bindings/test/volumes_test.go2
-rw-r--r--test/e2e/checkpoint_test.go3
-rw-r--r--test/e2e/common_test.go46
-rw-r--r--test/e2e/config_amd64.go16
-rw-r--r--test/e2e/container_create_volume_test.go2
-rw-r--r--test/e2e/containers_conf_test.go6
-rw-r--r--test/e2e/image_scp_test.go2
-rw-r--r--test/e2e/libpod_suite_remote_test.go1
-rw-r--r--test/e2e/logs_test.go5
-rw-r--r--test/e2e/network_test.go6
-rw-r--r--test/e2e/play_build_test.go4
-rw-r--r--test/e2e/play_kube_test.go69
-rw-r--r--test/e2e/pod_rm_test.go12
-rw-r--r--test/e2e/ps_test.go7
-rw-r--r--test/e2e/pull_test.go18
-rw-r--r--test/e2e/rmi_test.go6
-rw-r--r--test/e2e/run_networking_test.go6
-rw-r--r--test/e2e/run_privileged_test.go12
-rw-r--r--test/e2e/run_selinux_test.go2
-rw-r--r--test/e2e/run_test.go2
-rw-r--r--test/e2e/run_volume_test.go2
-rw-r--r--test/e2e/runlabel_test.go3
-rw-r--r--test/e2e/secret_test.go3
-rw-r--r--test/e2e/systemd_test.go8
-rw-r--r--test/e2e/toolbox_test.go12
-rw-r--r--test/e2e/volume_create_test.go3
-rw-r--r--test/testvol/main.go8
-rw-r--r--test/utils/common_function_test.go12
-rw-r--r--test/utils/matchers.go8
-rw-r--r--test/utils/utils.go26
48 files changed, 179 insertions, 186 deletions
diff --git a/.golangci.yml b/.golangci.yml
index cf067a58c..f3338b9ae 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -6,7 +6,6 @@ run:
skip-dirs:
- contrib
- dependencies
- - test
skip-files:
- swagger.go
modules-download-mode: readonly
diff --git a/pkg/bindings/test/attach_test.go b/pkg/bindings/test/attach_test.go
index 5c3ec48e4..c78836cb3 100644
--- a/pkg/bindings/test/attach_test.go
+++ b/pkg/bindings/test/attach_test.go
@@ -1,4 +1,4 @@
-package test_bindings
+package bindings_test
import (
"bytes"
diff --git a/pkg/bindings/test/auth_test.go b/pkg/bindings/test/auth_test.go
index d48a3eff7..26690c46a 100644
--- a/pkg/bindings/test/auth_test.go
+++ b/pkg/bindings/test/auth_test.go
@@ -1,4 +1,4 @@
-package test_bindings
+package bindings_test
import (
"io/ioutil"
diff --git a/pkg/bindings/test/common_test.go b/pkg/bindings/test/common_test.go
index 233666a48..76649f628 100644
--- a/pkg/bindings/test/common_test.go
+++ b/pkg/bindings/test/common_test.go
@@ -1,4 +1,4 @@
-package test_bindings
+package bindings_test
import (
"context"
@@ -51,7 +51,7 @@ var (
shortName: "busybox",
tarballName: "busybox.tar",
}
- CACHE_IMAGES = []testImage{alpine, busybox}
+ CACHE_IMAGES = []testImage{alpine, busybox} //nolint:golint,stylecheck
)
type bindingTest struct {
diff --git a/pkg/bindings/test/connection_test.go b/pkg/bindings/test/connection_test.go
index 561cf32b5..84a047bc9 100644
--- a/pkg/bindings/test/connection_test.go
+++ b/pkg/bindings/test/connection_test.go
@@ -1,4 +1,4 @@
-package test_bindings
+package bindings_test
import (
"context"
diff --git a/pkg/bindings/test/containers_test.go b/pkg/bindings/test/containers_test.go
index 0f535bc31..b6c06756b 100644
--- a/pkg/bindings/test/containers_test.go
+++ b/pkg/bindings/test/containers_test.go
@@ -1,4 +1,4 @@
-package test_bindings
+package bindings_test
import (
"net/http"
@@ -103,6 +103,7 @@ var _ = Describe("Podman containers ", func() {
Expect(err).To(BeNil())
// Pause by name
err = containers.Pause(bt.conn, name, nil)
+ Expect(err).To(BeNil(), "error from containers.Pause()")
//paused := "paused"
//_, err = containers.Wait(bt.conn, cid, &paused)
//Expect(err).To(BeNil())
diff --git a/pkg/bindings/test/create_test.go b/pkg/bindings/test/create_test.go
index 3c83aac02..f70ba7248 100644
--- a/pkg/bindings/test/create_test.go
+++ b/pkg/bindings/test/create_test.go
@@ -1,4 +1,4 @@
-package test_bindings
+package bindings_test
import (
"time"
diff --git a/pkg/bindings/test/exec_test.go b/pkg/bindings/test/exec_test.go
index c10452eaf..d2f9b121a 100644
--- a/pkg/bindings/test/exec_test.go
+++ b/pkg/bindings/test/exec_test.go
@@ -1,4 +1,4 @@
-package test_bindings
+package bindings_test
import (
"time"
diff --git a/pkg/bindings/test/generator_test.go b/pkg/bindings/test/generator_test.go
index d04cc10f9..ab0c49713 100644
--- a/pkg/bindings/test/generator_test.go
+++ b/pkg/bindings/test/generator_test.go
@@ -1,4 +1,4 @@
-package test_bindings
+package bindings_test
import (
"github.com/containers/podman/v3/pkg/bindings/containers"
diff --git a/pkg/bindings/test/images_test.go b/pkg/bindings/test/images_test.go
index aa8ff0537..8489e6ff1 100644
--- a/pkg/bindings/test/images_test.go
+++ b/pkg/bindings/test/images_test.go
@@ -1,4 +1,4 @@
-package test_bindings
+package bindings_test
import (
"net/http"
@@ -89,6 +89,10 @@ var _ = Describe("Podman images", func() {
response, errs := images.Remove(bt.conn, []string{"foobar5000"}, nil)
Expect(len(errs)).To(BeNumerically(">", 0))
code, _ := bindings.CheckResponseCode(errs[0])
+ // FIXME FIXME FIXME: #12441: THIS IS BROKEN
+ // FIXME FIXME FIXME: we get msg: "foobar5000: image not known"
+ // FIXME FIXME FIXME: ...with no ResponseCode
+ Expect(code).To(BeNumerically("==", -1))
// Remove an image by name, validate image is removed and error is nil
inspectData, err := images.GetImage(bt.conn, busybox.shortName, nil)
@@ -99,6 +103,7 @@ var _ = Describe("Podman images", func() {
Expect(inspectData.ID).To(Equal(response.Deleted[0]))
inspectData, err = images.GetImage(bt.conn, busybox.shortName, nil)
code, _ = bindings.CheckResponseCode(err)
+ Expect(code).To(BeNumerically("==", http.StatusNotFound))
// Start a container with alpine image
var top string = "top"
@@ -113,6 +118,9 @@ var _ = Describe("Podman images", func() {
// deleting hence image cannot be deleted until the container is deleted.
response, errs = images.Remove(bt.conn, []string{alpine.shortName}, nil)
code, _ = bindings.CheckResponseCode(errs[0])
+ // FIXME FIXME FIXME: #12441: another invalid error
+ // FIXME FIXME FIXME: this time msg="Image used by SHA: ..."
+ Expect(code).To(BeNumerically("==", -1))
// Removing the image "alpine" where force = true
options := new(images.RemoveOptions).WithForce(true)
@@ -122,10 +130,12 @@ var _ = Describe("Podman images", func() {
// is gone as well.
_, err = containers.Inspect(bt.conn, "top", nil)
code, _ = bindings.CheckResponseCode(err)
+ Expect(code).To(BeNumerically("==", http.StatusNotFound))
// Now make sure both images are gone.
inspectData, err = images.GetImage(bt.conn, busybox.shortName, nil)
code, _ = bindings.CheckResponseCode(err)
+ Expect(code).To(BeNumerically("==", http.StatusNotFound))
inspectData, err = images.GetImage(bt.conn, alpine.shortName, nil)
code, _ = bindings.CheckResponseCode(err)
@@ -339,6 +349,7 @@ var _ = Describe("Podman images", func() {
// Search with a fqdn
reports, err = images.Search(bt.conn, "quay.io/libpod/alpine_nginx", nil)
+ Expect(err).To(BeNil(), "Error in images.Search()")
Expect(len(reports)).To(BeNumerically(">=", 1))
})
diff --git a/pkg/bindings/test/info_test.go b/pkg/bindings/test/info_test.go
index f61e8c370..f643a2c28 100644
--- a/pkg/bindings/test/info_test.go
+++ b/pkg/bindings/test/info_test.go
@@ -1,4 +1,4 @@
-package test_bindings
+package bindings_test
import (
"runtime"
diff --git a/pkg/bindings/test/manifests_test.go b/pkg/bindings/test/manifests_test.go
index 4d8ca74bf..e65632057 100644
--- a/pkg/bindings/test/manifests_test.go
+++ b/pkg/bindings/test/manifests_test.go
@@ -1,4 +1,4 @@
-package test_bindings
+package bindings_test
import (
"net/http"
diff --git a/pkg/bindings/test/networks_test.go b/pkg/bindings/test/networks_test.go
index 85ceeb998..d95862f6f 100644
--- a/pkg/bindings/test/networks_test.go
+++ b/pkg/bindings/test/networks_test.go
@@ -1,4 +1,4 @@
-package test_bindings
+package bindings_test
import (
"context"
diff --git a/pkg/bindings/test/pods_test.go b/pkg/bindings/test/pods_test.go
index 879d4d00d..0a4261ea2 100644
--- a/pkg/bindings/test/pods_test.go
+++ b/pkg/bindings/test/pods_test.go
@@ -1,4 +1,4 @@
-package test_bindings
+package bindings_test
import (
"fmt"
@@ -79,6 +79,7 @@ var _ = Describe("Podman pods", func() {
var newpod2 string = "newpod2"
bt.Podcreate(&newpod2)
podSummary, err = pods.List(bt.conn, nil)
+ Expect(err).To(BeNil(), "Error from pods.List")
Expect(len(podSummary)).To(Equal(2))
var names []string
for _, i := range podSummary {
@@ -106,6 +107,7 @@ var _ = Describe("Podman pods", func() {
options := new(pods.ListOptions).WithFilters(filters)
filteredPods, err := pods.List(bt.conn, options)
Expect(err).ToNot(BeNil())
+ Expect(len(filteredPods)).To(Equal(0), "len(filteredPods)")
code, _ := bindings.CheckResponseCode(err)
Expect(code).To(BeNumerically("==", http.StatusInternalServerError))
@@ -301,6 +303,7 @@ var _ = Describe("Podman pods", func() {
// No pods pruned since no pod in exited state
pruneResponse, err := pods.Prune(bt.conn, nil)
Expect(err).To(BeNil())
+ Expect(len(pruneResponse)).To(Equal(0), "len(pruneResponse)")
podSummary, err := pods.List(bt.conn, nil)
Expect(err).To(BeNil())
Expect(len(podSummary)).To(Equal(2))
@@ -317,6 +320,7 @@ var _ = Describe("Podman pods", func() {
Expect(response.State).To(Equal(define.PodStateExited))
pruneResponse, err = pods.Prune(bt.conn, nil)
Expect(err).To(BeNil())
+ Expect(len(pruneResponse)).To(Equal(1), "len(pruneResponse)")
// Validate status and record pod id of pod to be pruned
Expect(response.State).To(Equal(define.PodStateExited))
podID := response.ID
diff --git a/pkg/bindings/test/resource_test.go b/pkg/bindings/test/resource_test.go
index b12d1ccd6..19ac33eb2 100644
--- a/pkg/bindings/test/resource_test.go
+++ b/pkg/bindings/test/resource_test.go
@@ -1,4 +1,4 @@
-package test_bindings
+package bindings_test
import (
"context"
diff --git a/pkg/bindings/test/secrets_test.go b/pkg/bindings/test/secrets_test.go
index 5edb37f18..52c964556 100644
--- a/pkg/bindings/test/secrets_test.go
+++ b/pkg/bindings/test/secrets_test.go
@@ -1,4 +1,4 @@
-package test_bindings
+package bindings_test
import (
"context"
diff --git a/pkg/bindings/test/system_test.go b/pkg/bindings/test/system_test.go
index aecc5db81..4549a14c9 100644
--- a/pkg/bindings/test/system_test.go
+++ b/pkg/bindings/test/system_test.go
@@ -1,4 +1,4 @@
-package test_bindings
+package bindings_test
import (
"sync"
diff --git a/pkg/bindings/test/test_suite_test.go b/pkg/bindings/test/test_suite_test.go
index d2c2c7838..8fb46c205 100644
--- a/pkg/bindings/test/test_suite_test.go
+++ b/pkg/bindings/test/test_suite_test.go
@@ -1,4 +1,4 @@
-package test_bindings_test
+package bindings_test
import (
"testing"
diff --git a/pkg/bindings/test/volumes_test.go b/pkg/bindings/test/volumes_test.go
index 14bda114e..43ef54889 100644
--- a/pkg/bindings/test/volumes_test.go
+++ b/pkg/bindings/test/volumes_test.go
@@ -1,4 +1,4 @@
-package test_bindings
+package bindings_test
import (
"context"
diff --git a/test/e2e/checkpoint_test.go b/test/e2e/checkpoint_test.go
index cc827a453..318e3617e 100644
--- a/test/e2e/checkpoint_test.go
+++ b/test/e2e/checkpoint_test.go
@@ -1019,6 +1019,9 @@ var _ = Describe("Podman checkpoint", func() {
"podman checkpoint and restore container out of and into pod (%s)",
share,
)
+
+ share := share // copy into local scope, for use inside function
+
It(testName, func() {
if !criu.CheckForCriu(criu.PodCriuVersion) {
Skip("CRIU is missing or too old.")
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go
index 6180343a7..63cb4f091 100644
--- a/test/e2e/common_test.go
+++ b/test/e2e/common_test.go
@@ -24,7 +24,6 @@ import (
"github.com/containers/storage/pkg/reexec"
"github.com/containers/storage/pkg/stringid"
jsoniter "github.com/json-iterator/go"
- "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec"
@@ -33,16 +32,14 @@ import (
)
var (
- PODMAN_BINARY string
- CONMON_BINARY string
- CNI_CONFIG_DIR string
- RUNC_BINARY string
- INTEGRATION_ROOT string
- CGROUP_MANAGER = "systemd"
- ARTIFACT_DIR = "/tmp/.artifacts"
- RESTORE_IMAGES = []string{ALPINE, BB, nginx}
+ //lint:ignore ST1003
+ PODMAN_BINARY string //nolint:golint,stylecheck
+ INTEGRATION_ROOT string //nolint:golint,stylecheck
+ CGROUP_MANAGER = "systemd" //nolint:golint,stylecheck
+ ARTIFACT_DIR = "/tmp/.artifacts" //nolint:golint,stylecheck
+ RESTORE_IMAGES = []string{ALPINE, BB, nginx} //nolint:golint,stylecheck
defaultWaitTimeout = 90
- CGROUPSV2, _ = cgroups.IsCgroup2UnifiedMode()
+ CGROUPSV2, _ = cgroups.IsCgroup2UnifiedMode() //nolint:golint,stylecheck
)
// PodmanTestIntegration struct for command line options
@@ -74,8 +71,6 @@ type testResult struct {
length float64
}
-var noCache = "Cannot run nocache with remote"
-
type testResultsSorted []testResult
func (a testResultsSorted) Len() int { return len(a) }
@@ -475,7 +470,7 @@ func (p *PodmanTestIntegration) PodmanPID(args []string) (*PodmanSessionIntegrat
if err != nil {
Fail(fmt.Sprintf("unable to run podman command: %s", strings.Join(podmanOptions, " ")))
}
- podmanSession := &PodmanSession{session}
+ podmanSession := &PodmanSession{Session: session}
return &PodmanSessionIntegration{podmanSession}, command.Process.Pid
}
@@ -597,9 +592,9 @@ func (p *PodmanTestIntegration) RunHealthCheck(cid string) error {
return errors.Errorf("unable to detect %s as running", cid)
}
-func (p *PodmanTestIntegration) CreateSeccompJson(in []byte) (string, error) {
+func (p *PodmanTestIntegration) CreateSeccompJSON(in []byte) (string, error) {
jsonFile := filepath.Join(p.TempDir, "seccomp.json")
- err := WriteJsonFile(in, jsonFile)
+ err := WriteJSONFile(in, jsonFile)
if err != nil {
return "", err
}
@@ -622,14 +617,14 @@ func SkipIfRootlessCgroupsV1(reason string) {
func SkipIfRootless(reason string) {
checkReason(reason)
if os.Geteuid() != 0 {
- ginkgo.Skip("[rootless]: " + reason)
+ Skip("[rootless]: " + reason)
}
}
func SkipIfNotRootless(reason string) {
checkReason(reason)
if os.Geteuid() == 0 {
- ginkgo.Skip("[notRootless]: " + reason)
+ Skip("[notRootless]: " + reason)
}
}
@@ -640,7 +635,7 @@ func SkipIfSystemdNotRunning(reason string) {
err := cmd.Run()
if err != nil {
if _, ok := err.(*exec.Error); ok {
- ginkgo.Skip("[notSystemd]: not running " + reason)
+ Skip("[notSystemd]: not running " + reason)
}
Expect(err).ToNot(HaveOccurred())
}
@@ -649,14 +644,14 @@ func SkipIfSystemdNotRunning(reason string) {
func SkipIfNotSystemd(manager, reason string) {
checkReason(reason)
if manager != "systemd" {
- ginkgo.Skip("[notSystemd]: " + reason)
+ Skip("[notSystemd]: " + reason)
}
}
func SkipIfNotFedora() {
info := GetHostDistributionInfo()
if info.Distribution != "fedora" {
- ginkgo.Skip("Test can only run on Fedora")
+ Skip("Test can only run on Fedora")
}
}
@@ -684,10 +679,7 @@ func SkipIfCgroupV2(reason string) {
func isContainerized() bool {
// This is set to "podman" by podman automatically
- if os.Getenv("container") != "" {
- return true
- }
- return false
+ return os.Getenv("container") != ""
}
func SkipIfContainerized(reason string) {
@@ -702,7 +694,7 @@ func SkipIfRemote(reason string) {
if !IsRemote() {
return
}
- ginkgo.Skip("[remote]: " + reason)
+ Skip("[remote]: " + reason)
}
// SkipIfInContainer skips a test if the test is run inside a container
@@ -872,10 +864,10 @@ func (p *PodmanTestIntegration) removeCNINetwork(name string) {
Expect(session.ExitCode()).To(BeNumerically("<=", 1), "Exit code must be 0 or 1")
}
-func (p *PodmanSessionIntegration) jq(jqCommand string) (string, error) {
+func (s *PodmanSessionIntegration) jq(jqCommand string) (string, error) {
var out bytes.Buffer
cmd := exec.Command("jq", jqCommand)
- cmd.Stdin = strings.NewReader(p.OutputToString())
+ cmd.Stdin = strings.NewReader(s.OutputToString())
cmd.Stdout = &out
err := cmd.Run()
return strings.TrimRight(out.String(), "\n"), err
diff --git a/test/e2e/config_amd64.go b/test/e2e/config_amd64.go
index 3607bdc30..9293fdd44 100644
--- a/test/e2e/config_amd64.go
+++ b/test/e2e/config_amd64.go
@@ -1,16 +1,16 @@
package integration
var (
- STORAGE_FS = "vfs"
- STORAGE_OPTIONS = "--storage-driver vfs"
- ROOTLESS_STORAGE_FS = "vfs"
- ROOTLESS_STORAGE_OPTIONS = "--storage-driver vfs"
- CACHE_IMAGES = []string{ALPINE, BB, fedoraMinimal, nginx, redis, registry, infra, labels, healthcheck, ubi_init, ubi_minimal, fedoraToolbox}
+ STORAGE_FS = "vfs" //nolint:golint,stylecheck
+ STORAGE_OPTIONS = "--storage-driver vfs" //nolint:golint,stylecheck
+ ROOTLESS_STORAGE_FS = "vfs" //nolint:golint,stylecheck
+ ROOTLESS_STORAGE_OPTIONS = "--storage-driver vfs" //nolint:golint,stylecheck
+ CACHE_IMAGES = []string{ALPINE, BB, fedoraMinimal, nginx, redis, registry, infra, labels, healthcheck, UBI_INIT, UBI_MINIMAL, fedoraToolbox} //nolint:golint,stylecheck
nginx = "quay.io/libpod/alpine_nginx:latest"
- BB_GLIBC = "docker.io/library/busybox:glibc"
+ BB_GLIBC = "docker.io/library/busybox:glibc" //nolint:golint,stylecheck
registry = "quay.io/libpod/registry:2.6"
labels = "quay.io/libpod/alpine_labels:latest"
- ubi_minimal = "registry.access.redhat.com/ubi8-minimal"
- ubi_init = "registry.access.redhat.com/ubi8-init"
+ UBI_MINIMAL = "registry.access.redhat.com/ubi8-minimal" //nolint:golint,stylecheck
+ UBI_INIT = "registry.access.redhat.com/ubi8-init" //nolint:golint,stylecheck
cirros = "quay.io/libpod/cirros:latest"
)
diff --git a/test/e2e/container_create_volume_test.go b/test/e2e/container_create_volume_test.go
index 001698239..0dac96a5e 100644
--- a/test/e2e/container_create_volume_test.go
+++ b/test/e2e/container_create_volume_test.go
@@ -28,7 +28,7 @@ VOLUME %s/`, data, dest, dest)
func createContainersConfFile(pTest *PodmanTestIntegration) {
configPath := filepath.Join(pTest.TempDir, "containers.conf")
- containersConf := []byte(fmt.Sprintf("[containers]\nprepare_volume_on_create = true\n"))
+ containersConf := []byte("[containers]\nprepare_volume_on_create = true\n")
err := ioutil.WriteFile(configPath, containersConf, os.ModePerm)
Expect(err).To(BeNil())
diff --git a/test/e2e/containers_conf_test.go b/test/e2e/containers_conf_test.go
index 6a760da17..6bc230aae 100644
--- a/test/e2e/containers_conf_test.go
+++ b/test/e2e/containers_conf_test.go
@@ -407,7 +407,7 @@ var _ = Describe("Podman run", func() {
configPath := filepath.Join(podmanTest.TempDir, "containers.conf")
os.Setenv("CONTAINERS_CONF", configPath)
- containersConf := []byte(fmt.Sprintf("[engine]\nimage_copy_tmp_dir=\"/foobar\""))
+ containersConf := []byte("[engine]\nimage_copy_tmp_dir=\"/foobar\"")
err = ioutil.WriteFile(configPath, containersConf, os.ModePerm)
Expect(err).To(BeNil())
@@ -420,7 +420,7 @@ var _ = Describe("Podman run", func() {
Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Equal("/foobar"))
- containersConf = []byte(fmt.Sprintf("[engine]\nimage_copy_tmp_dir=\"storage\""))
+ containersConf = []byte("[engine]\nimage_copy_tmp_dir=\"storage\"")
err = ioutil.WriteFile(configPath, containersConf, os.ModePerm)
Expect(err).To(BeNil())
if IsRemote() {
@@ -432,7 +432,7 @@ var _ = Describe("Podman run", func() {
Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("containers/storage/tmp"))
- containersConf = []byte(fmt.Sprintf("[engine]\nimage_copy_tmp_dir=\"storage1\""))
+ containersConf = []byte("[engine]\nimage_copy_tmp_dir=\"storage1\"")
err = ioutil.WriteFile(configPath, containersConf, os.ModePerm)
Expect(err).To(BeNil())
if IsRemote() {
diff --git a/test/e2e/image_scp_test.go b/test/e2e/image_scp_test.go
index 63276e57f..6c6c85bc3 100644
--- a/test/e2e/image_scp_test.go
+++ b/test/e2e/image_scp_test.go
@@ -62,7 +62,7 @@ var _ = Describe("podman image scp", func() {
})
It("podman image scp root to rootless transfer", func() {
- SkipIfNotRootless("this is a rootless only test, transfering from root to rootless using PodmanAsUser")
+ SkipIfNotRootless("this is a rootless only test, transferring from root to rootless using PodmanAsUser")
if IsRemote() {
Skip("this test is only for non-remote")
}
diff --git a/test/e2e/libpod_suite_remote_test.go b/test/e2e/libpod_suite_remote_test.go
index 1fa29daa1..2ecbd0eab 100644
--- a/test/e2e/libpod_suite_remote_test.go
+++ b/test/e2e/libpod_suite_remote_test.go
@@ -111,7 +111,6 @@ func (p *PodmanTestIntegration) StopRemoteService() {
if _, err := remoteSession.Wait(); err != nil {
fmt.Fprintf(os.Stderr, "error on remote stop-wait %q", err)
}
-
} else {
parentPid := fmt.Sprintf("%d", p.RemoteSession.Pid)
pgrep := exec.Command("pgrep", "-P", parentPid)
diff --git a/test/e2e/logs_test.go b/test/e2e/logs_test.go
index d901dde5c..2558af0eb 100644
--- a/test/e2e/logs_test.go
+++ b/test/e2e/logs_test.go
@@ -20,10 +20,7 @@ func isEventBackendJournald(podmanTest *PodmanTestIntegration) bool {
}
info := podmanTest.Podman([]string{"info", "--format", "{{.Host.EventLogger}}"})
info.WaitWithDefaultTimeout()
- if info.OutputToString() == "journald" {
- return true
- }
- return false
+ return info.OutputToString() == "journald"
}
var _ = Describe("Podman logs", func() {
diff --git a/test/e2e/network_test.go b/test/e2e/network_test.go
index 953380335..734a45bca 100644
--- a/test/e2e/network_test.go
+++ b/test/e2e/network_test.go
@@ -185,7 +185,7 @@ var _ = Describe("Podman network", func() {
Expect(session).Should(Exit(0))
})
- rm_func := func(rm string) {
+ rmFunc := func(rm string) {
It(fmt.Sprintf("podman network %s no args", rm), func() {
session := podmanTest.Podman([]string{"network", rm})
session.WaitWithDefaultTimeout()
@@ -213,8 +213,8 @@ var _ = Describe("Podman network", func() {
})
}
- rm_func("rm")
- rm_func("remove")
+ rmFunc("rm")
+ rmFunc("remove")
It("podman network inspect no args", func() {
session := podmanTest.Podman([]string{"network", "inspect"})
diff --git a/test/e2e/play_build_test.go b/test/e2e/play_build_test.go
index 564735e07..9bdf9d06b 100644
--- a/test/e2e/play_build_test.go
+++ b/test/e2e/play_build_test.go
@@ -95,6 +95,7 @@ LABEL marge=mom
// Setup
yamlDir := filepath.Join(tempdir, RandomString(12))
err := os.Mkdir(yamlDir, 0755)
+ Expect(err).To(BeNil(), "mkdir "+yamlDir)
err = writeYaml(testYAML, filepath.Join(yamlDir, "top.yaml"))
Expect(err).To(BeNil())
app1Dir := filepath.Join(yamlDir, "foobar")
@@ -131,6 +132,7 @@ LABEL marge=mom
// Setup
yamlDir := filepath.Join(tempdir, RandomString(12))
err := os.Mkdir(yamlDir, 0755)
+ Expect(err).To(BeNil(), "mkdir "+yamlDir)
err = writeYaml(testYAML, filepath.Join(yamlDir, "top.yaml"))
Expect(err).To(BeNil())
app1Dir := filepath.Join(yamlDir, "foobar")
@@ -167,6 +169,7 @@ LABEL marge=mom
// Setup
yamlDir := filepath.Join(tempdir, RandomString(12))
err := os.Mkdir(yamlDir, 0755)
+ Expect(err).To(BeNil(), "mkdir "+yamlDir)
err = writeYaml(testYAML, filepath.Join(yamlDir, "top.yaml"))
Expect(err).To(BeNil())
@@ -213,6 +216,7 @@ LABEL marge=mom
// Setup
yamlDir := filepath.Join(tempdir, RandomString(12))
err := os.Mkdir(yamlDir, 0755)
+ Expect(err).To(BeNil(), "os.Mkdir "+yamlDir)
err = writeYaml(testYAML, filepath.Join(yamlDir, "top.yaml"))
Expect(err).To(BeNil())
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go
index 1a3b5f8df..fc939711f 100644
--- a/test/e2e/play_kube_test.go
+++ b/test/e2e/play_kube_test.go
@@ -4,8 +4,6 @@ import (
"bytes"
"context"
"fmt"
- "github.com/containers/podman/v3/pkg/bindings"
- "github.com/containers/podman/v3/pkg/bindings/play"
"io/ioutil"
"net"
"net/url"
@@ -17,6 +15,8 @@ import (
"time"
"github.com/containers/podman/v3/libpod/define"
+ "github.com/containers/podman/v3/pkg/bindings"
+ "github.com/containers/podman/v3/pkg/bindings/play"
"github.com/containers/podman/v3/pkg/util"
. "github.com/containers/podman/v3/test/utils"
"github.com/containers/storage/pkg/stringid"
@@ -319,16 +319,16 @@ spec:
image: {{ .Image }}
name: {{ .Name }}
imagePullPolicy: {{ .PullPolicy }}
- {{- if or .CpuRequest .CpuLimit .MemoryRequest .MemoryLimit }}
+ {{- if or .CPURequest .CPULimit .MemoryRequest .MemoryLimit }}
resources:
- {{- if or .CpuRequest .MemoryRequest }}
+ {{- if or .CPURequest .MemoryRequest }}
requests:
- {{if .CpuRequest }}cpu: {{ .CpuRequest }}{{ end }}
+ {{if .CPURequest }}cpu: {{ .CPURequest }}{{ end }}
{{if .MemoryRequest }}memory: {{ .MemoryRequest }}{{ end }}
{{- end }}
- {{- if or .CpuLimit .MemoryLimit }}
+ {{- if or .CPULimit .MemoryLimit }}
limits:
- {{if .CpuLimit }}cpu: {{ .CpuLimit }}{{ end }}
+ {{if .CPULimit }}cpu: {{ .CPULimit }}{{ end }}
{{if .MemoryLimit }}memory: {{ .MemoryLimit }}{{ end }}
{{- end }}
{{- end }}
@@ -479,16 +479,16 @@ spec:
image: {{ .Image }}
name: {{ .Name }}
imagePullPolicy: {{ .PullPolicy }}
- {{- if or .CpuRequest .CpuLimit .MemoryRequest .MemoryLimit }}
+ {{- if or .CPURequest .CPULimit .MemoryRequest .MemoryLimit }}
resources:
- {{- if or .CpuRequest .MemoryRequest }}
+ {{- if or .CPURequest .MemoryRequest }}
requests:
- {{if .CpuRequest }}cpu: {{ .CpuRequest }}{{ end }}
+ {{if .CPURequest }}cpu: {{ .CPURequest }}{{ end }}
{{if .MemoryRequest }}memory: {{ .MemoryRequest }}{{ end }}
{{- end }}
- {{- if or .CpuLimit .MemoryLimit }}
+ {{- if or .CPULimit .MemoryLimit }}
limits:
- {{if .CpuLimit }}cpu: {{ .CpuLimit }}{{ end }}
+ {{if .CPULimit }}cpu: {{ .CPULimit }}{{ end }}
{{if .MemoryLimit }}memory: {{ .MemoryLimit }}{{ end }}
{{- end }}
{{- end }}
@@ -820,12 +820,6 @@ func getDeployment(options ...deploymentOption) *Deployment {
type deploymentOption func(*Deployment)
-func withDeploymentLabel(k, v string) deploymentOption {
- return func(deployment *Deployment) {
- deployment.Labels[k] = v
- }
-}
-
func withDeploymentAnnotation(k, v string) deploymentOption {
return func(deployment *Deployment) {
deployment.Annotations[k] = v
@@ -866,8 +860,8 @@ type Ctr struct {
Image string
Cmd []string
Arg []string
- CpuRequest string
- CpuLimit string
+ CPURequest string
+ CPULimit string
MemoryRequest string
MemoryLimit string
SecurityContext bool
@@ -947,15 +941,15 @@ func withImage(img string) ctrOption {
}
}
-func withCpuRequest(request string) ctrOption {
+func withCPURequest(request string) ctrOption {
return func(c *Ctr) {
- c.CpuRequest = request
+ c.CPURequest = request
}
}
-func withCpuLimit(limit string) ctrOption {
+func withCPULimit(limit string) ctrOption {
return func(c *Ctr) {
- c.CpuLimit = limit
+ c.CPULimit = limit
}
}
@@ -1848,7 +1842,7 @@ var _ = Describe("Podman play kube", func() {
It("podman play kube seccomp container level", func() {
SkipIfRemote("podman-remote does not support --seccomp-profile-root flag")
// expect play kube is expected to set a seccomp label if it's applied as an annotation
- jsonFile, err := podmanTest.CreateSeccompJson(seccompPwdEPERM)
+ jsonFile, err := podmanTest.CreateSeccompJSON(seccompPwdEPERM)
if err != nil {
fmt.Println(err)
Skip("Failed to prepare seccomp.json for test.")
@@ -1861,7 +1855,7 @@ var _ = Describe("Podman play kube", func() {
err = generateKubeYaml("pod", pod, kubeYaml)
Expect(err).To(BeNil())
- // CreateSeccompJson will put the profile into podmanTest.TempDir. Use --seccomp-profile-root to tell play kube where to look
+ // CreateSeccompJSON will put the profile into podmanTest.TempDir. Use --seccomp-profile-root to tell play kube where to look
kube := podmanTest.Podman([]string{"play", "kube", "--seccomp-profile-root", podmanTest.TempDir, kubeYaml})
kube.WaitWithDefaultTimeout()
Expect(kube).Should(Exit(0))
@@ -1875,7 +1869,7 @@ var _ = Describe("Podman play kube", func() {
It("podman play kube seccomp pod level", func() {
SkipIfRemote("podman-remote does not support --seccomp-profile-root flag")
// expect play kube is expected to set a seccomp label if it's applied as an annotation
- jsonFile, err := podmanTest.CreateSeccompJson(seccompPwdEPERM)
+ jsonFile, err := podmanTest.CreateSeccompJSON(seccompPwdEPERM)
if err != nil {
fmt.Println(err)
Skip("Failed to prepare seccomp.json for test.")
@@ -1888,7 +1882,7 @@ var _ = Describe("Podman play kube", func() {
err = generateKubeYaml("pod", pod, kubeYaml)
Expect(err).To(BeNil())
- // CreateSeccompJson will put the profile into podmanTest.TempDir. Use --seccomp-profile-root to tell play kube where to look
+ // CreateSeccompJSON will put the profile into podmanTest.TempDir. Use --seccomp-profile-root to tell play kube where to look
kube := podmanTest.Podman([]string{"play", "kube", "--seccomp-profile-root", podmanTest.TempDir, kubeYaml})
kube.WaitWithDefaultTimeout()
Expect(kube).Should(Exit(0))
@@ -2348,19 +2342,19 @@ VOLUME %s`, ALPINE, hostPathDir+"/")
var (
numReplicas int32 = 3
- expectedCpuRequest string = "100m"
- expectedCpuLimit string = "200m"
+ expectedCPURequest string = "100m"
+ expectedCPULimit string = "200m"
expectedMemoryRequest string = "10000000"
expectedMemoryLimit string = "20000000"
)
- expectedCpuQuota := milliCPUToQuota(expectedCpuLimit)
+ expectedCPUQuota := milliCPUToQuota(expectedCPULimit)
deployment := getDeployment(
withReplicas(numReplicas),
withPod(getPod(withCtr(getCtr(
- withCpuRequest(expectedCpuRequest),
- withCpuLimit(expectedCpuLimit),
+ withCPURequest(expectedCPURequest),
+ withCPULimit(expectedCPULimit),
withMemoryRequest(expectedMemoryRequest),
withMemoryLimit(expectedMemoryLimit),
)))))
@@ -2372,6 +2366,7 @@ VOLUME %s`, ALPINE, hostPathDir+"/")
Expect(kube).Should(Exit(0))
for _, pod := range getPodNamesInDeployment(deployment) {
+ pod := pod // copy into local scope
inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(&pod), "--format", `
CpuPeriod: {{ .HostConfig.CpuPeriod }}
CpuQuota: {{ .HostConfig.CpuQuota }}
@@ -2379,7 +2374,7 @@ Memory: {{ .HostConfig.Memory }}
MemoryReservation: {{ .HostConfig.MemoryReservation }}`})
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
- Expect(inspect.OutputToString()).To(ContainSubstring(fmt.Sprintf("%s: %d", "CpuQuota", expectedCpuQuota)))
+ Expect(inspect.OutputToString()).To(ContainSubstring(fmt.Sprintf("%s: %d", "CpuQuota", expectedCPUQuota)))
Expect(inspect.OutputToString()).To(ContainSubstring("MemoryReservation: " + expectedMemoryRequest))
Expect(inspect.OutputToString()).To(ContainSubstring("Memory: " + expectedMemoryLimit))
}
@@ -2391,12 +2386,12 @@ MemoryReservation: {{ .HostConfig.MemoryReservation }}`})
podmanTest.CgroupManager = "systemd"
var (
- expectedCpuLimit string = "1"
+ expectedCPULimit string = "1"
)
deployment := getDeployment(
withPod(getPod(withCtr(getCtr(
- withCpuLimit(expectedCpuLimit),
+ withCPULimit(expectedCPULimit),
)))))
err := generateKubeYaml("deployment", deployment, kubeYaml)
Expect(err).To(BeNil())
@@ -2406,6 +2401,7 @@ MemoryReservation: {{ .HostConfig.MemoryReservation }}`})
Expect(kube).Should(Exit(0))
for _, pod := range getPodNamesInDeployment(deployment) {
+ pod := pod // copy into local scope
inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(&pod), "--format", `{{ .HostConfig.CpuPeriod }}:{{ .HostConfig.CpuQuota }}`})
inspect.WaitWithDefaultTimeout()
@@ -3054,6 +3050,7 @@ ENV OPENJ9_JAVA_OPTIONS=%q
deployment := getDeployment(withPod(pod))
deploymentYaml, err := getKubeYaml("deployment", deployment)
+ Expect(err).To(BeNil(), "getKubeYaml(deployment)")
yamls := []string{cmYaml, deploymentYaml}
err = generateMultiDocKubeYaml(yamls, kubeYaml)
Expect(err).To(BeNil())
diff --git a/test/e2e/pod_rm_test.go b/test/e2e/pod_rm_test.go
index 7dc3dfa7f..d9b0761fa 100644
--- a/test/e2e/pod_rm_test.go
+++ b/test/e2e/pod_rm_test.go
@@ -132,11 +132,11 @@ var _ = Describe("Podman pod rm", func() {
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
fmt.Printf("Started container running in one pod")
- num_pods := podmanTest.NumberOfPods()
- Expect(num_pods).To(Equal(2))
+ numPods := podmanTest.NumberOfPods()
+ Expect(numPods).To(Equal(2))
ps := podmanTest.Podman([]string{"pod", "ps"})
ps.WaitWithDefaultTimeout()
- fmt.Printf("Current %d pod(s):\n%s\n", num_pods, ps.OutputToString())
+ fmt.Printf("Current %d pod(s):\n%s\n", numPods, ps.OutputToString())
fmt.Printf("Removing all empty pods\n")
result := podmanTest.Podman([]string{"pod", "rm", "-a"})
@@ -145,11 +145,11 @@ var _ = Describe("Podman pod rm", func() {
foundExpectedError, _ := result.ErrorGrepString("cannot be removed")
Expect(foundExpectedError).To(Equal(true))
- num_pods = podmanTest.NumberOfPods()
+ numPods = podmanTest.NumberOfPods()
ps = podmanTest.Podman([]string{"pod", "ps"})
ps.WaitWithDefaultTimeout()
- fmt.Printf("Final %d pod(s):\n%s\n", num_pods, ps.OutputToString())
- Expect(num_pods).To(Equal(1))
+ fmt.Printf("Final %d pod(s):\n%s\n", numPods, ps.OutputToString())
+ Expect(numPods).To(Equal(1))
// Confirm top container still running inside remaining pod
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
})
diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go
index 666b70b09..c0b0e0aa6 100644
--- a/test/e2e/ps_test.go
+++ b/test/e2e/ps_test.go
@@ -443,11 +443,10 @@ var _ = Describe("Podman ps", func() {
// sanity check in case an oddly formatted size appears
if len(matches1) < 2 || len(matches2) < 2 {
return sortedArr[i] < sortedArr[j]
- } else {
- size1, _ := units.FromHumanSize(matches1[1])
- size2, _ := units.FromHumanSize(matches2[1])
- return size1 < size2
}
+ size1, _ := units.FromHumanSize(matches1[1])
+ size2, _ := units.FromHumanSize(matches2[1])
+ return size1 < size2
})).To(BeTrue())
})
diff --git a/test/e2e/pull_test.go b/test/e2e/pull_test.go
index fdb1b0c57..b2474b223 100644
--- a/test/e2e/pull_test.go
+++ b/test/e2e/pull_test.go
@@ -279,7 +279,7 @@ var _ = Describe("Podman pull", func() {
// Pulling a multi-image archive without further specifying
// which image _must_ error out. Pulling is restricted to one
// image.
- session = podmanTest.Podman([]string{"pull", fmt.Sprintf("docker-archive:./testdata/docker-two-images.tar.xz")})
+ session = podmanTest.Podman([]string{"pull", "docker-archive:./testdata/docker-two-images.tar.xz"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(125))
expectedError := "Unexpected tar manifest.json: expected 1 item, got 2"
@@ -288,31 +288,31 @@ var _ = Describe("Podman pull", func() {
// Now pull _one_ image from a multi-image archive via the name
// and index syntax.
- session = podmanTest.Podman([]string{"pull", fmt.Sprintf("docker-archive:./testdata/docker-two-images.tar.xz:@0")})
+ session = podmanTest.Podman([]string{"pull", "docker-archive:./testdata/docker-two-images.tar.xz:@0"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- session = podmanTest.Podman([]string{"pull", fmt.Sprintf("docker-archive:./testdata/docker-two-images.tar.xz:example.com/empty:latest")})
+ session = podmanTest.Podman([]string{"pull", "docker-archive:./testdata/docker-two-images.tar.xz:example.com/empty:latest"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- session = podmanTest.Podman([]string{"pull", fmt.Sprintf("docker-archive:./testdata/docker-two-images.tar.xz:@1")})
+ session = podmanTest.Podman([]string{"pull", "docker-archive:./testdata/docker-two-images.tar.xz:@1"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- session = podmanTest.Podman([]string{"pull", fmt.Sprintf("docker-archive:./testdata/docker-two-images.tar.xz:example.com/empty/but:different")})
+ session = podmanTest.Podman([]string{"pull", "docker-archive:./testdata/docker-two-images.tar.xz:example.com/empty/but:different"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
// Now check for some errors.
- session = podmanTest.Podman([]string{"pull", fmt.Sprintf("docker-archive:./testdata/docker-two-images.tar.xz:foo.com/does/not/exist:latest")})
+ session = podmanTest.Podman([]string{"pull", "docker-archive:./testdata/docker-two-images.tar.xz:foo.com/does/not/exist:latest"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(125))
expectedError = "Tag \"foo.com/does/not/exist:latest\" not found"
found, _ = session.ErrorGrepString(expectedError)
Expect(found).To(Equal(true))
- session = podmanTest.Podman([]string{"pull", fmt.Sprintf("docker-archive:./testdata/docker-two-images.tar.xz:@2")})
+ session = podmanTest.Podman([]string{"pull", "docker-archive:./testdata/docker-two-images.tar.xz:@2"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(125))
expectedError = "Invalid source index @2, only 2 manifest items available"
@@ -391,7 +391,7 @@ var _ = Describe("Podman pull", func() {
setup := podmanTest.Podman([]string{"images", ALPINE, "-q", "--no-trunc"})
setup.WaitWithDefaultTimeout()
Expect(setup).Should(Exit(0))
- shortImageId := strings.Split(setup.OutputToString(), ":")[1]
+ shortImageID := strings.Split(setup.OutputToString(), ":")[1]
rmi := podmanTest.Podman([]string{"rmi", ALPINE})
rmi.WaitWithDefaultTimeout()
@@ -401,7 +401,7 @@ var _ = Describe("Podman pull", func() {
pull.WaitWithDefaultTimeout()
Expect(pull).Should(Exit(0))
- Expect(pull.OutputToString()).To(ContainSubstring(shortImageId))
+ Expect(pull.OutputToString()).To(ContainSubstring(shortImageID))
})
It("podman pull check all tags", func() {
diff --git a/test/e2e/rmi_test.go b/test/e2e/rmi_test.go
index 196d8879d..4f6d974fd 100644
--- a/test/e2e/rmi_test.go
+++ b/test/e2e/rmi_test.go
@@ -97,19 +97,19 @@ var _ = Describe("Podman rmi", func() {
setup := podmanTest.Podman([]string{"images", "-q", cirros})
setup.WaitWithDefaultTimeout()
Expect(setup).Should(Exit(0))
- cirrosId := setup.OutputToString()
+ cirrosID := setup.OutputToString()
session := podmanTest.Podman([]string{"tag", "cirros", "foo:bar", "foo"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
// Trying without --force should fail
- result := podmanTest.Podman([]string{"rmi", cirrosId})
+ result := podmanTest.Podman([]string{"rmi", cirrosID})
result.WaitWithDefaultTimeout()
Expect(result).To(ExitWithError())
// With --force it should work
- resultForce := podmanTest.Podman([]string{"rmi", "-f", cirrosId})
+ resultForce := podmanTest.Podman([]string{"rmi", "-f", cirrosID})
resultForce.WaitWithDefaultTimeout()
Expect(resultForce).Should(Exit(0))
})
diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go
index e2004c8e0..5898cc38d 100644
--- a/test/e2e/run_networking_test.go
+++ b/test/e2e/run_networking_test.go
@@ -789,7 +789,7 @@ EXPOSE 2004-2005/tcp`, ALPINE)
Expect(run.OutputToString()).ToNot(ContainSubstring("127.0.0.1 %s", hostname))
})
- ping_test := func(netns string) {
+ pingTest := func(netns string) {
hostname := "testctr"
run := podmanTest.Podman([]string{"run", netns, "--hostname", hostname, ALPINE, "ping", "-c", "1", hostname})
run.WaitWithDefaultTimeout()
@@ -801,11 +801,11 @@ EXPOSE 2004-2005/tcp`, ALPINE)
}
It("podman attempt to ping container name and hostname --net=none", func() {
- ping_test("--net=none")
+ pingTest("--net=none")
})
It("podman attempt to ping container name and hostname --net=private", func() {
- ping_test("--net=private")
+ pingTest("--net=private")
})
It("podman run check dnsname plugin", func() {
diff --git a/test/e2e/run_privileged_test.go b/test/e2e/run_privileged_test.go
index d793a01f8..321bf27ac 100644
--- a/test/e2e/run_privileged_test.go
+++ b/test/e2e/run_privileged_test.go
@@ -21,18 +21,18 @@ func containerCapMatchesHost(ctrCap string, hostCap string) {
if isRootless() {
return
}
- ctrCap_n, err := strconv.ParseUint(ctrCap, 16, 64)
+ ctrCapN, err := strconv.ParseUint(ctrCap, 16, 64)
Expect(err).NotTo(HaveOccurred(), "Error parsing %q as hex", ctrCap)
- hostCap_n, err := strconv.ParseUint(hostCap, 16, 64)
+ hostCapN, err := strconv.ParseUint(hostCap, 16, 64)
Expect(err).NotTo(HaveOccurred(), "Error parsing %q as hex", hostCap)
// host caps can never be zero (except rootless).
// and host caps must always be a superset (inclusive) of container
- Expect(hostCap_n).To(BeNumerically(">", 0), "host cap %q should be nonzero", hostCap)
- Expect(hostCap_n).To(BeNumerically(">=", ctrCap_n), "host cap %q should never be less than container cap %q", hostCap, ctrCap)
- hostCap_masked := hostCap_n & (1<<len(capability.List()) - 1)
- Expect(ctrCap_n).To(Equal(hostCap_masked), "container cap %q is not a subset of host cap %q", ctrCap, hostCap)
+ Expect(hostCapN).To(BeNumerically(">", 0), "host cap %q should be nonzero", hostCap)
+ Expect(hostCapN).To(BeNumerically(">=", ctrCapN), "host cap %q should never be less than container cap %q", hostCap, ctrCap)
+ hostCapMasked := hostCapN & (1<<len(capability.List()) - 1)
+ Expect(ctrCapN).To(Equal(hostCapMasked), "container cap %q is not a subset of host cap %q", ctrCap, hostCap)
}
var _ = Describe("Podman privileged container tests", func() {
diff --git a/test/e2e/run_selinux_test.go b/test/e2e/run_selinux_test.go
index cf63760cc..a6672d45e 100644
--- a/test/e2e/run_selinux_test.go
+++ b/test/e2e/run_selinux_test.go
@@ -320,7 +320,7 @@ var _ = Describe("Podman run", func() {
})
It("podman test init labels", func() {
- session := podmanTest.Podman([]string{"create", ubi_init, "/sbin/init"})
+ session := podmanTest.Podman([]string{"create", UBI_INIT, "/sbin/init"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
cid := session.OutputToString()
diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go
index aa9037e56..7b08c48c3 100644
--- a/test/e2e/run_test.go
+++ b/test/e2e/run_test.go
@@ -318,7 +318,7 @@ var _ = Describe("Podman run", func() {
forbidGetCWDSeccompProfile := func() string {
in := []byte(`{"defaultAction":"SCMP_ACT_ALLOW","syscalls":[{"name":"getcwd","action":"SCMP_ACT_ERRNO"}]}`)
- jsonFile, err := podmanTest.CreateSeccompJson(in)
+ jsonFile, err := podmanTest.CreateSeccompJSON(in)
if err != nil {
fmt.Println(err)
Skip("Failed to prepare seccomp.json for test.")
diff --git a/test/e2e/run_volume_test.go b/test/e2e/run_volume_test.go
index 967cf4a7c..196c5778a 100644
--- a/test/e2e/run_volume_test.go
+++ b/test/e2e/run_volume_test.go
@@ -151,6 +151,7 @@ var _ = Describe("Podman run with volumes", func() {
Expect(err).To(BeNil())
testFile := filepath.Join(mountPath, "test1")
f, err := os.Create(testFile)
+ Expect(err).To(BeNil(), "os.Create(testfile)")
f.Close()
Expect(err).To(BeNil())
session := podmanTest.Podman([]string{"run", "-v", fmt.Sprintf("%s:/data", mountPath), redis, "ls", "/data/test1"})
@@ -550,6 +551,7 @@ VOLUME /test/`, ALPINE)
os.Mkdir(mountPath, 0755)
testFile := filepath.Join(mountPath, "test1")
f, err := os.Create(testFile)
+ Expect(err).To(BeNil(), "os.Create "+testFile)
f.Close()
// Make sure host directory gets mounted in to container as overlay
diff --git a/test/e2e/runlabel_test.go b/test/e2e/runlabel_test.go
index 656eaaceb..e473119b2 100644
--- a/test/e2e/runlabel_test.go
+++ b/test/e2e/runlabel_test.go
@@ -105,7 +105,8 @@ var _ = Describe("podman container runlabel", func() {
})
It("podman container runlabel global options", func() {
- Skip("Test nonfunctional for podman-in-podman testing")
+ fmt.Printf("FIXME: for lint. Remove when you fix this test: %s", GlobalDockerfile)
+ Skip("FIXME: $GLOBAL_OPTS does not work at all, #12436")
image := "podman-global-test:ls"
podmanTest.BuildImage(GlobalDockerfile, image, "false")
result := podmanTest.Podman([]string{"--syslog", "--log-level", "debug", "container", "runlabel", "RUN", image})
diff --git a/test/e2e/secret_test.go b/test/e2e/secret_test.go
index 8bbc889d7..df0cd24d0 100644
--- a/test/e2e/secret_test.go
+++ b/test/e2e/secret_test.go
@@ -208,7 +208,6 @@ var _ = Describe("Podman secret", func() {
// no env variable set, should fail
session := podmanTest.Podman([]string{"secret", "create", "--env", "a", "MYENVVAR"})
session.WaitWithDefaultTimeout()
- secrID := session.OutputToString()
Expect(session).To(ExitWithError())
os.Setenv("MYENVVAR", "somedata")
@@ -218,7 +217,7 @@ var _ = Describe("Podman secret", func() {
session = podmanTest.Podman([]string{"secret", "create", "--env", "a", "MYENVVAR"})
session.WaitWithDefaultTimeout()
- secrID = session.OutputToString()
+ secrID := session.OutputToString()
Expect(session).Should(Exit(0))
inspect := podmanTest.Podman([]string{"secret", "inspect", "--format", "{{.ID}}", secrID})
diff --git a/test/e2e/systemd_test.go b/test/e2e/systemd_test.go
index 32c2cd1b8..6b4df939c 100644
--- a/test/e2e/systemd_test.go
+++ b/test/e2e/systemd_test.go
@@ -50,8 +50,8 @@ WantedBy=multi-user.target
SkipIfRootless("rootless can not write to /etc")
SkipIfContainerized("test does not have systemd as pid 1")
- sys_file := ioutil.WriteFile("/etc/systemd/system/redis.service", []byte(systemdUnitFile), 0644)
- Expect(sys_file).To(BeNil())
+ sysFile := ioutil.WriteFile("/etc/systemd/system/redis.service", []byte(systemdUnitFile), 0644)
+ Expect(sysFile).To(BeNil())
defer func() {
stop := SystemExec("bash", []string{"-c", "systemctl stop redis"})
os.Remove("/etc/systemd/system/redis.service")
@@ -78,7 +78,7 @@ WantedBy=multi-user.target
It("podman run container with systemd PID1", func() {
ctrName := "testSystemd"
- run := podmanTest.Podman([]string{"run", "--name", ctrName, "-t", "-i", "-d", ubi_init, "/sbin/init"})
+ run := podmanTest.Podman([]string{"run", "--name", ctrName, "-t", "-i", "-d", UBI_INIT, "/sbin/init"})
run.WaitWithDefaultTimeout()
Expect(run).Should(Exit(0))
@@ -118,7 +118,7 @@ WantedBy=multi-user.target
It("podman create container with systemd entrypoint triggers systemd mode", func() {
ctrName := "testCtr"
- run := podmanTest.Podman([]string{"create", "--name", ctrName, "--entrypoint", "/sbin/init", ubi_init})
+ run := podmanTest.Podman([]string{"create", "--name", ctrName, "--entrypoint", "/sbin/init", UBI_INIT})
run.WaitWithDefaultTimeout()
Expect(run).Should(Exit(0))
diff --git a/test/e2e/toolbox_test.go b/test/e2e/toolbox_test.go
index e1fe44675..40db5180a 100644
--- a/test/e2e/toolbox_test.go
+++ b/test/e2e/toolbox_test.go
@@ -66,9 +66,7 @@ var _ = Describe("Toolbox-specific testing", func() {
})
It("podman run --dns=none - allows self-management of /etc/resolv.conf", func() {
- var session *PodmanSessionIntegration
-
- session = podmanTest.Podman([]string{"run", "--dns", "none", ALPINE, "sh", "-c",
+ session := podmanTest.Podman([]string{"run", "--dns", "none", ALPINE, "sh", "-c",
"rm -f /etc/resolv.conf; touch -d '1970-01-01 00:02:03' /etc/resolv.conf; stat -c %s:%Y /etc/resolv.conf"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
@@ -76,9 +74,7 @@ var _ = Describe("Toolbox-specific testing", func() {
})
It("podman run --no-hosts - allows self-management of /etc/hosts", func() {
- var session *PodmanSessionIntegration
-
- session = podmanTest.Podman([]string{"run", "--no-hosts", ALPINE, "sh", "-c",
+ session := podmanTest.Podman([]string{"run", "--no-hosts", ALPINE, "sh", "-c",
"rm -f /etc/hosts; touch -d '1970-01-01 00:02:03' /etc/hosts; stat -c %s:%Y /etc/hosts"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
@@ -164,9 +160,7 @@ var _ = Describe("Toolbox-specific testing", func() {
})
It("podman create --userns=keep-id --user root:root - entrypoint - entrypoint is executed as root", func() {
- var session *PodmanSessionIntegration
-
- session = podmanTest.Podman([]string{"run", "--userns=keep-id", "--user", "root:root", ALPINE,
+ session := podmanTest.Podman([]string{"run", "--userns=keep-id", "--user", "root:root", ALPINE,
"id"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
diff --git a/test/e2e/volume_create_test.go b/test/e2e/volume_create_test.go
index d1f769724..90a9bfb0b 100644
--- a/test/e2e/volume_create_test.go
+++ b/test/e2e/volume_create_test.go
@@ -97,13 +97,12 @@ var _ = Describe("Podman volume create", func() {
session = podmanTest.Podman([]string{"volume", "create", "my_vol2"})
session.WaitWithDefaultTimeout()
- volName = session.OutputToString()
Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"volume", "import", "my_vol2", "hello.tar"})
session.WaitWithDefaultTimeout()
- volName = session.OutputToString()
Expect(session).Should(Exit(0))
+ Expect(session.OutputToString()).To(Equal(""), "output of volume import")
session = podmanTest.Podman([]string{"run", "--volume", "my_vol2:/data", ALPINE, "cat", "/data/test"})
session.WaitWithDefaultTimeout()
diff --git a/test/testvol/main.go b/test/testvol/main.go
index a0f58348b..d15bf00cd 100644
--- a/test/testvol/main.go
+++ b/test/testvol/main.go
@@ -129,8 +129,8 @@ func (d *DirDriver) Capabilities() *volume.CapabilitiesResponse {
logrus.Infof("Hit Capabilities() endpoint")
return &volume.CapabilitiesResponse{
- volume.Capability{
- "local",
+ Capabilities: volume.Capability{
+ Scope: "local",
},
}
}
@@ -260,7 +260,7 @@ func (d *DirDriver) Path(req *volume.PathRequest) (*volume.PathResponse, error)
}
return &volume.PathResponse{
- vol.path,
+ Mountpoint: vol.path,
}, nil
}
@@ -280,7 +280,7 @@ func (d *DirDriver) Mount(req *volume.MountRequest) (*volume.MountResponse, erro
vol.mounts[req.ID] = true
return &volume.MountResponse{
- vol.path,
+ Mountpoint: vol.path,
}, nil
}
diff --git a/test/utils/common_function_test.go b/test/utils/common_function_test.go
index 003d490ce..c996a302c 100644
--- a/test/utils/common_function_test.go
+++ b/test/utils/common_function_test.go
@@ -90,24 +90,24 @@ var _ = Describe("Common functions test", func() {
Entry("Command exist", "Fakecmd", false),
)
- It("Test WriteJsonFile", func() {
- type testJson struct {
+ It("Test WriteJSONFile", func() {
+ type testJSON struct {
Item1 int
Item2 []string
}
- compareData := &testJson{}
+ compareData := &testJSON{}
- testData := &testJson{
+ testData := &testJSON{
Item1: 5,
Item2: []string{"test"},
}
testByte, _ := json.Marshal(testData)
- err := WriteJsonFile(testByte, "/tmp/testJson")
+ err := WriteJSONFile(testByte, "/tmp/testJSON")
Expect(err).To(BeNil(), "Failed to write JSON to file.")
- read, err := os.Open("/tmp/testJson")
+ read, err := os.Open("/tmp/testJSON")
defer read.Close()
Expect(err).To(BeNil(), "Can not find the JSON file after we write it.")
diff --git a/test/utils/matchers.go b/test/utils/matchers.go
index 17ff3ea75..69fb0cdfe 100644
--- a/test/utils/matchers.go
+++ b/test/utils/matchers.go
@@ -5,7 +5,7 @@ import (
"net/url"
"github.com/containers/common/pkg/config"
- . "github.com/onsi/gomega"
+ . "github.com/onsi/gomega" //nolint:golint,stylecheck
"github.com/onsi/gomega/format"
"github.com/onsi/gomega/gexec"
"github.com/onsi/gomega/matchers"
@@ -95,7 +95,7 @@ func (matcher *URLMatcher) Match(actual interface{}) (bool, error) {
if !ok {
return false, fmt.Errorf("VerifyURL requires string inputs %T is not supported", matcher.Expected)
}
- e_uri, err := url.Parse(e)
+ eURI, err := url.Parse(e)
if err != nil {
return false, err
}
@@ -104,12 +104,12 @@ func (matcher *URLMatcher) Match(actual interface{}) (bool, error) {
if !ok {
return false, fmt.Errorf("VerifyURL requires string inputs %T is not supported", actual)
}
- a_uri, err := url.Parse(a)
+ aURI, err := url.Parse(a)
if err != nil {
return false, err
}
- return (&matchers.EqualMatcher{Expected: e_uri}).Match(a_uri)
+ return (&matchers.EqualMatcher{Expected: eURI}).Match(aURI)
}
type ExitMatcher struct {
diff --git a/test/utils/utils.go b/test/utils/utils.go
index 4a57d9ce7..944c1ac3c 100644
--- a/test/utils/utils.go
+++ b/test/utils/utils.go
@@ -13,9 +13,9 @@ import (
"time"
"github.com/containers/storage/pkg/parsers/kernel"
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/gexec"
+ . "github.com/onsi/ginkgo" //nolint:golint,stylecheck
+ . "github.com/onsi/gomega" //nolint:golint,stylecheck
+ . "github.com/onsi/gomega/gexec" //nolint:golint,stylecheck
)
var (
@@ -439,25 +439,21 @@ func IsKernelNewerThan(version string) (bool, error) {
return true, nil
}
return false, nil
-
}
// IsCommandAvailable check if command exist
func IsCommandAvailable(command string) bool {
check := exec.Command("bash", "-c", strings.Join([]string{"command -v", command}, " "))
err := check.Run()
- if err != nil {
- return false
- }
- return true
+ return err == nil
}
-// WriteJsonFile write json format data to a json file
-func WriteJsonFile(data []byte, filePath string) error {
+// WriteJSONFile write json format data to a json file
+func WriteJSONFile(data []byte, filePath string) error {
var jsonData map[string]interface{}
json.Unmarshal(data, &jsonData)
- formatJson, _ := json.MarshalIndent(jsonData, "", " ")
- return ioutil.WriteFile(filePath, formatJson, 0644)
+ formatJSON, _ := json.MarshalIndent(jsonData, "", " ")
+ return ioutil.WriteFile(filePath, formatJSON, 0644)
}
// Containerized check the podman command run inside container
@@ -471,10 +467,7 @@ func Containerized() bool {
// shrug, if we cannot read that file, return false
return false
}
- if strings.Index(string(b), "docker") > -1 {
- return true
- }
- return false
+ return strings.Contains(string(b), "docker")
}
func init() {
@@ -485,7 +478,6 @@ var randomLetters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
// RandomString returns a string of given length composed of random characters
func RandomString(n int) string {
-
b := make([]rune, n)
for i := range b {
b[i] = randomLetters[rand.Intn(len(randomLetters))]