make lint: re-enable ginkgolinter

To make sure the e2e tests are kept in order.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
Valentin Rothberg
2023-06-19 15:09:34 +02:00
parent 2efa7c3fa1
commit aa453c4f11
16 changed files with 24 additions and 27 deletions

View File

@ -17,7 +17,6 @@ linters:
- revive - revive
- tagalign - tagalign
# useful hints that should be addressed # useful hints that should be addressed
- ginkgolinter
- nakedret - nakedret
- gosmopolitan # usage of time.Local in pkg/k8s.io - gosmopolitan # usage of time.Local in pkg/k8s.io
- tagliatelle # too many JSON keys cannot be changed due to compat - tagliatelle # too many JSON keys cannot be changed due to compat

View File

@ -1,8 +1,6 @@
package e2e_test package e2e_test
import ( import (
"strings"
"github.com/containers/podman/v4/pkg/machine" "github.com/containers/podman/v4/pkg/machine"
jsoniter "github.com/json-iterator/go" jsoniter "github.com/json-iterator/go"
@ -67,7 +65,7 @@ var _ = Describe("podman machine stop", func() {
var inspectInfo []machine.InspectInfo var inspectInfo []machine.InspectInfo
err = jsoniter.Unmarshal(inspectSession.Bytes(), &inspectInfo) err = jsoniter.Unmarshal(inspectSession.Bytes(), &inspectInfo)
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
Expect(strings.HasSuffix(inspectInfo[0].ConnectionInfo.PodmanSocket.GetPath(), "podman.sock")) Expect(inspectInfo[0].ConnectionInfo.PodmanSocket.GetPath()).To(HaveSuffix("podman.sock"))
inspect := new(inspectMachine) inspect := new(inspectMachine)
inspect = inspect.withFormat("{{.Name}}") inspect = inspect.withFormat("{{.Name}}")

View File

@ -52,12 +52,12 @@ var _ = Describe("podman machine list", func() {
firstList, err := mb.setCmd(list.withQuiet()).run() firstList, err := mb.setCmd(list.withQuiet()).run()
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())
Expect(firstList).Should(Exit(0)) Expect(firstList).Should(Exit(0))
Expect(firstList.outputToStringSlice()).To(HaveLen(0)) // No header with quiet Expect(firstList.outputToStringSlice()).To(BeEmpty()) // No header with quiet
noheaderSession, err := mb.setCmd(list.withNoHeading()).run() // noheader noheaderSession, err := mb.setCmd(list.withNoHeading()).run() // noheader
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())
Expect(noheaderSession).Should(Exit(0)) Expect(noheaderSession).Should(Exit(0))
Expect(noheaderSession.outputToStringSlice()).To(HaveLen(0)) Expect(noheaderSession.outputToStringSlice()).To(BeEmpty())
i := new(initMachine) i := new(initMachine)
session, err := mb.setName(name1).setCmd(i.withImagePath(mb.imagePath)).run() session, err := mb.setName(name1).setCmd(i.withImagePath(mb.imagePath)).run()

View File

@ -315,7 +315,7 @@ var _ = Describe("Podman create", func() {
It("podman create --authfile with nonexistent authfile", func() { It("podman create --authfile with nonexistent authfile", func() {
session := podmanTest.Podman([]string{"create", "--authfile", "/tmp/nonexistent", "--name=foo", ALPINE}) session := podmanTest.Podman([]string{"create", "--authfile", "/tmp/nonexistent", "--name=foo", ALPINE})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).To(Not(Equal(0))) Expect(session).ToNot(HaveValue(Equal(0)))
}) })
It("podman create --signature-policy", func() { It("podman create --signature-policy", func() {

View File

@ -182,7 +182,7 @@ var _ = Describe("Podman kube generate", func() {
err := yaml.Unmarshal(kube.Out.Contents(), pod) err := yaml.Unmarshal(kube.Out.Contents(), pod)
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
Expect(pod.Spec).To(HaveField("HostNetwork", false)) Expect(pod.Spec).To(HaveField("HostNetwork", false))
Expect(pod.Annotations).To(HaveLen(0)) Expect(pod.Annotations).To(BeEmpty())
numContainers := 0 numContainers := 0
for range pod.Spec.Containers { for range pod.Spec.Containers {

View File

@ -192,7 +192,7 @@ WORKDIR /test
result := podmanTest.Podman([]string{"images", "-q", "-f", "dangling=true"}) result := podmanTest.Podman([]string{"images", "-q", "-f", "dangling=true"})
result.WaitWithDefaultTimeout() result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0), "dangling image output: %q", result.OutputToString()) Expect(result).Should(Exit(0), "dangling image output: %q", result.OutputToString())
Expect(result.OutputToStringArray()).Should(HaveLen(0), "dangling image output: %q", result.OutputToString()) Expect(result.OutputToStringArray()).Should(BeEmpty(), "dangling image output: %q", result.OutputToString())
}) })
It("podman pull by digest and list --all", func() { It("podman pull by digest and list --all", func() {

View File

@ -571,7 +571,7 @@ var _ = Describe("Podman inspect", func() {
session = podmanTest.Podman([]string{"container", "inspect", cid, "-f", "{{ .State.Error }}"}) session = podmanTest.Podman([]string{"container", "inspect", cid, "-f", "{{ .State.Error }}"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(HaveLen(0)) Expect(session.OutputToString()).To(BeEmpty())
session = podmanTest.Podman([]string{"start", cid}) session = podmanTest.Podman([]string{"start", cid})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
@ -579,7 +579,7 @@ var _ = Describe("Podman inspect", func() {
session = podmanTest.Podman([]string{"container", "inspect", cid, "-f", "'{{ .State.Error }}"}) session = podmanTest.Podman([]string{"container", "inspect", cid, "-f", "'{{ .State.Error }}"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(Not(HaveLen(0))) Expect(session.OutputToString()).ToNot(BeEmpty())
}) })
}) })

View File

@ -569,7 +569,7 @@ var _ = Describe("Podman network", func() {
Expect(result).To(HaveField("Driver", "macvlan")) Expect(result).To(HaveField("Driver", "macvlan"))
Expect(result).To(HaveField("NetworkInterface", "lo")) Expect(result).To(HaveField("NetworkInterface", "lo"))
Expect(result.IPAMOptions).To(HaveKeyWithValue("driver", "dhcp")) Expect(result.IPAMOptions).To(HaveKeyWithValue("driver", "dhcp"))
Expect(result.Subnets).To(HaveLen(0)) Expect(result.Subnets).To(BeEmpty())
nc = podmanTest.Podman([]string{"network", "rm", net}) nc = podmanTest.Podman([]string{"network", "rm", net})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()
@ -599,7 +599,7 @@ var _ = Describe("Podman network", func() {
Expect(result).To(HaveField("Driver", "ipvlan")) Expect(result).To(HaveField("Driver", "ipvlan"))
Expect(result).To(HaveField("NetworkInterface", "lo")) Expect(result).To(HaveField("NetworkInterface", "lo"))
Expect(result.IPAMOptions).To(HaveKeyWithValue("driver", "dhcp")) Expect(result.IPAMOptions).To(HaveKeyWithValue("driver", "dhcp"))
Expect(result.Subnets).To(HaveLen(0)) Expect(result.Subnets).To(BeEmpty())
nc = podmanTest.Podman([]string{"network", "rm", net}) nc = podmanTest.Podman([]string{"network", "rm", net})
nc.WaitWithDefaultTimeout() nc.WaitWithDefaultTimeout()

View File

@ -464,7 +464,7 @@ var _ = Describe("Podman pause", func() {
session1 = podmanTest.Podman([]string{"pause", "-a", "--filter", fmt.Sprintf("id=%swrongid", shortCid3)}) session1 = podmanTest.Podman([]string{"pause", "-a", "--filter", fmt.Sprintf("id=%swrongid", shortCid3)})
session1.WaitWithDefaultTimeout() session1.WaitWithDefaultTimeout()
Expect(session1).Should(Exit(0)) Expect(session1).Should(Exit(0))
Expect(session1.OutputToString()).To(HaveLen(0)) Expect(session1.OutputToString()).To(BeEmpty())
session1 = podmanTest.Podman([]string{"pause", "-a", "--filter", fmt.Sprintf("id=%s", shortCid3)}) session1 = podmanTest.Podman([]string{"pause", "-a", "--filter", fmt.Sprintf("id=%s", shortCid3)})
session1.WaitWithDefaultTimeout() session1.WaitWithDefaultTimeout()
@ -474,7 +474,7 @@ var _ = Describe("Podman pause", func() {
session1 = podmanTest.Podman([]string{"unpause", "-a", "--filter", fmt.Sprintf("id=%swrongid", shortCid3)}) session1 = podmanTest.Podman([]string{"unpause", "-a", "--filter", fmt.Sprintf("id=%swrongid", shortCid3)})
session1.WaitWithDefaultTimeout() session1.WaitWithDefaultTimeout()
Expect(session1).Should(Exit(0)) Expect(session1).Should(Exit(0))
Expect(session1.OutputToString()).To(HaveLen(0)) Expect(session1.OutputToString()).To(BeEmpty())
session1 = podmanTest.Podman([]string{"unpause", "-a", "--filter", fmt.Sprintf("id=%s", shortCid3)}) session1 = podmanTest.Podman([]string{"unpause", "-a", "--filter", fmt.Sprintf("id=%s", shortCid3)})
session1.WaitWithDefaultTimeout() session1.WaitWithDefaultTimeout()

View File

@ -3665,7 +3665,7 @@ o: {{ .Options.o }}`})
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout() kube.WaitWithDefaultTimeout()
if IsRemote() { if IsRemote() {
Expect(kube).Error() Expect(kube).To(ExitWithError())
Expect(kube.ErrorToString()).To(ContainSubstring("importing volumes is not supported for remote requests")) Expect(kube.ErrorToString()).To(ContainSubstring("importing volumes is not supported for remote requests"))
return return
} }
@ -4947,7 +4947,7 @@ spec:
ps := podmanTest.Podman([]string{"pod", "ps", "-q"}) ps := podmanTest.Podman([]string{"pod", "ps", "-q"})
ps.WaitWithDefaultTimeout() ps.WaitWithDefaultTimeout()
Expect(ps).Should(Exit(0)) Expect(ps).Should(Exit(0))
Expect(ps.OutputToStringArray()).To(HaveLen(0)) Expect(ps.OutputToStringArray()).To(BeEmpty())
}) })
It("podman play kube with named volume subpaths", func() { It("podman play kube with named volume subpaths", func() {

View File

@ -1058,9 +1058,9 @@ ENTRYPOINT ["sleep","99999"]
data := inspectPod.InspectPodToJSON() data := inspectPod.InspectPodToJSON()
inspect := podmanTest.InspectContainer(ctrCreate.OutputToString()) inspect := podmanTest.InspectContainer(ctrCreate.OutputToString())
Expect(data.CgroupPath).To(HaveLen(0)) Expect(data.CgroupPath).To(BeEmpty())
if podmanTest.CgroupManager == "cgroupfs" || !isRootless() { if podmanTest.CgroupManager == "cgroupfs" || !isRootless() {
Expect(inspect[0].HostConfig.CgroupParent).To(HaveLen(0)) Expect(inspect[0].HostConfig.CgroupParent).To(BeEmpty())
} else if podmanTest.CgroupManager == "systemd" { } else if podmanTest.CgroupManager == "systemd" {
Expect(inspect[0].HostConfig).To(HaveField("CgroupParent", "user.slice")) Expect(inspect[0].HostConfig).To(HaveField("CgroupParent", "user.slice"))
} }

View File

@ -261,7 +261,7 @@ var _ = Describe("Podman prune", func() {
session = podmanTest.Podman([]string{"network", "ls", "-q", "--filter", "name=^test$"}) session = podmanTest.Podman([]string{"network", "ls", "-q", "--filter", "name=^test$"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
Expect(session.OutputToStringArray()).To(HaveLen(0)) Expect(session.OutputToStringArray()).To(BeEmpty())
// Create new network. // Create new network.
session = podmanTest.Podman([]string{"network", "create", "test1", "--label", "foo"}) session = podmanTest.Podman([]string{"network", "create", "test1", "--label", "foo"})

View File

@ -324,7 +324,7 @@ var _ = Describe("Podman restart", func() {
session1 = podmanTest.Podman([]string{"restart", "-a", "--filter", fmt.Sprintf("id=%swrongid", shortCid3)}) session1 = podmanTest.Podman([]string{"restart", "-a", "--filter", fmt.Sprintf("id=%swrongid", shortCid3)})
session1.WaitWithDefaultTimeout() session1.WaitWithDefaultTimeout()
Expect(session1).Should(Exit(0)) Expect(session1).Should(Exit(0))
Expect(session1.OutputToString()).To(HaveLen(0)) Expect(session1.OutputToString()).To(BeEmpty())
session1 = podmanTest.Podman([]string{"restart", "-a", "--filter", fmt.Sprintf("id=%s", shortCid3)}) session1 = podmanTest.Podman([]string{"restart", "-a", "--filter", fmt.Sprintf("id=%s", shortCid3)})
session1.WaitWithDefaultTimeout() session1.WaitWithDefaultTimeout()

View File

@ -305,7 +305,7 @@ var _ = Describe("Podman rm", func() {
session1 = podmanTest.Podman([]string{"rm", "-a", "-f", "--filter", fmt.Sprintf("id=%swrongid", shortCid3)}) session1 = podmanTest.Podman([]string{"rm", "-a", "-f", "--filter", fmt.Sprintf("id=%swrongid", shortCid3)})
session1.WaitWithDefaultTimeout() session1.WaitWithDefaultTimeout()
Expect(session1).Should(Exit(0)) Expect(session1).Should(Exit(0))
Expect(session1.OutputToString()).To(HaveLen(0)) Expect(session1.OutputToString()).To(BeEmpty())
session1 = podmanTest.Podman([]string{"rm", "-a", "-f", "--filter", fmt.Sprintf("id=%s", shortCid3)}) session1 = podmanTest.Podman([]string{"rm", "-a", "-f", "--filter", fmt.Sprintf("id=%s", shortCid3)})
session1.WaitWithDefaultTimeout() session1.WaitWithDefaultTimeout()

View File

@ -145,7 +145,7 @@ var _ = Describe("Podman start", func() {
wait.WaitWithDefaultTimeout() wait.WaitWithDefaultTimeout()
Expect(wait).To(ExitWithError()) Expect(wait).To(ExitWithError())
Eventually(podmanTest.NumberOfContainers(), defaultWaitTimeout, 3.0).Should(BeZero()) Eventually(podmanTest.NumberOfContainers, defaultWaitTimeout, 3.0).Should(BeZero())
}) })
It("podman failed to start without --rm should NOT delete the container", func() { It("podman failed to start without --rm should NOT delete the container", func() {
@ -157,7 +157,7 @@ var _ = Describe("Podman start", func() {
start.WaitWithDefaultTimeout() start.WaitWithDefaultTimeout()
Expect(start).To(ExitWithError()) Expect(start).To(ExitWithError())
Eventually(podmanTest.NumberOfContainers(), defaultWaitTimeout, 3.0).Should(Equal(1)) Eventually(podmanTest.NumberOfContainers, defaultWaitTimeout, 3.0).Should(Equal(1))
}) })
It("podman start --sig-proxy should not work without --attach", func() { It("podman start --sig-proxy should not work without --attach", func() {
@ -216,12 +216,12 @@ var _ = Describe("Podman start", func() {
session1 = podmanTest.Podman([]string{"start", cid1, "-f", "status=running"}) session1 = podmanTest.Podman([]string{"start", cid1, "-f", "status=running"})
session1.WaitWithDefaultTimeout() session1.WaitWithDefaultTimeout()
Expect(session1).Should(Exit(0)) Expect(session1).Should(Exit(0))
Expect(session1.OutputToString()).To(HaveLen(0)) Expect(session1.OutputToString()).To(BeEmpty())
session1 = podmanTest.Podman([]string{"start", "--all", "--filter", fmt.Sprintf("id=%swrongid", shortCid3)}) session1 = podmanTest.Podman([]string{"start", "--all", "--filter", fmt.Sprintf("id=%swrongid", shortCid3)})
session1.WaitWithDefaultTimeout() session1.WaitWithDefaultTimeout()
Expect(session1).Should(Exit(0)) Expect(session1).Should(Exit(0))
Expect(session1.OutputToString()).To(HaveLen(0)) Expect(session1.OutputToString()).To(BeEmpty())
session1 = podmanTest.Podman([]string{"start", "--all", "--filter", fmt.Sprintf("id=%s", shortCid3)}) session1 = podmanTest.Podman([]string{"start", "--all", "--filter", fmt.Sprintf("id=%s", shortCid3)})
session1.WaitWithDefaultTimeout() session1.WaitWithDefaultTimeout()

View File

@ -398,7 +398,7 @@ var _ = Describe("Podman stop", func() {
session1 = podmanTest.Podman([]string{"stop", "-a", "--filter", fmt.Sprintf("id=%swrongid", shortCid3)}) session1 = podmanTest.Podman([]string{"stop", "-a", "--filter", fmt.Sprintf("id=%swrongid", shortCid3)})
session1.WaitWithDefaultTimeout() session1.WaitWithDefaultTimeout()
Expect(session1).Should(Exit(0)) Expect(session1).Should(Exit(0))
Expect(session1.OutputToString()).To(HaveLen(0)) Expect(session1.OutputToString()).To(BeEmpty())
session1 = podmanTest.Podman([]string{"stop", "-a", "--filter", fmt.Sprintf("id=%s", shortCid3)}) session1 = podmanTest.Podman([]string{"stop", "-a", "--filter", fmt.Sprintf("id=%s", shortCid3)})
session1.WaitWithDefaultTimeout() session1.WaitWithDefaultTimeout()