ginkgo tests: apply ginkgolinter fixes

New fixes since my last commit 2ddf1c5cbd.

https://github.com/nunnatsa/ginkgolinter

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger 2022-12-20 16:47:17 +01:00
parent ca40371ff5
commit 8e05caef6c
No known key found for this signature in database
GPG Key ID: EB145DD938A3CAF2
8 changed files with 18 additions and 18 deletions

View File

@ -4435,7 +4435,7 @@ cgroups="disabled"`), 0644)
defer os.Unsetenv("CONTAINERS_CONF")
os.Setenv("CONTAINERS_CONF", conffile)
err = writeYaml(simplePodYaml, kubeYaml)
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()

View File

@ -542,7 +542,7 @@ var _ = Describe("Podman prune", func() {
// have: containers.json, containers.lock and container dir
dirents, err := os.ReadDir(containerStorageDir)
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
Expect(dirents).To(HaveLen(3))
prune := podmanTest.Podman([]string{"system", "prune", "--external", "-f"})
@ -554,7 +554,7 @@ var _ = Describe("Podman prune", func() {
// still have: containers.json, containers.lock and container dir
dirents, err = os.ReadDir(containerStorageDir)
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
Expect(dirents).To(HaveLen(3))
})
@ -574,14 +574,14 @@ var _ = Describe("Podman prune", func() {
// containers.json, containers.lock and container 1 dir
dirents, err := os.ReadDir(containerStorageDir)
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
Expect(dirents).To(HaveLen(3))
// Drop podman database and storage, losing track of container 1 (but directory remains)
err = os.Remove(filepath.Join(containerStorageDir, "containers.json"))
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
err = os.RemoveAll(dbDir)
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
@ -594,7 +594,7 @@ var _ = Describe("Podman prune", func() {
// containers.json, containers.lock and container 1&2 dir
dirents, err = os.ReadDir(containerStorageDir)
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
Expect(dirents).To(HaveLen(4))
prune := podmanTest.Podman([]string{"system", "prune", "--external", "-f"})
@ -603,7 +603,7 @@ var _ = Describe("Podman prune", func() {
// container 1 dir should be gone now
dirents, err = os.ReadDir(containerStorageDir)
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
Expect(dirents).To(HaveLen(3))
})
})

View File

@ -567,11 +567,11 @@ var _ = Describe("Podman pull", func() {
bitSize := 1024
keyFileName := filepath.Join(podmanTest.TempDir, "key")
publicKeyFileName, privateKeyFileName, err := WriteRSAKeyPair(keyFileName, bitSize)
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
wrongKeyFileName := filepath.Join(podmanTest.TempDir, "wrong_key")
_, wrongPrivateKeyFileName, err := WriteRSAKeyPair(wrongKeyFileName, bitSize)
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
session := podmanTest.Podman([]string{"push", "--encryption-key", "jwe:" + publicKeyFileName, "--tls-verify=false", "--remove-signatures", ALPINE, imgPath})
session.WaitWithDefaultTimeout()

View File

@ -130,7 +130,7 @@ var _ = Describe("Podman push", func() {
bitSize := 1024
keyFileName := filepath.Join(podmanTest.TempDir, "key")
publicKeyFileName, _, err := WriteRSAKeyPair(keyFileName, bitSize)
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
if !IsRemote() { // Remote does not support --encryption-key
push = podmanTest.Podman([]string{"push", "--encryption-key", "jwe:" + publicKeyFileName, "--tls-verify=false", "--remove-signatures", ALPINE, "localhost:5000/my-alpine"})
@ -295,7 +295,7 @@ var _ = Describe("Podman push", func() {
bitSize := 1024
keyFileName := filepath.Join(podmanTest.TempDir, "key")
publicKeyFileName, _, err := WriteRSAKeyPair(keyFileName, bitSize)
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
session := podmanTest.Podman([]string{"push", "--encryption-key", "jwe:" + publicKeyFileName, ALPINE, fmt.Sprintf("oci:%s", bbdir)})
session.WaitWithDefaultTimeout()

View File

@ -209,7 +209,7 @@ func (t *quadletTestcase) assertSymlink(args []string, unit *parser.UnitFile) bo
}
func (t *quadletTestcase) doAssert(check []string, unit *parser.UnitFile, session *PodmanSessionIntegration) error {
Expect(len(check)).To(BeNumerically(">=", 1))
Expect(check).ToNot(BeEmpty())
op := check[0]
args := make([]string, 0)
for _, a := range check[1:] {

View File

@ -16,7 +16,7 @@ func createContainersConfFileWithDevices(pTest *PodmanTestIntegration, devices s
configPath := filepath.Join(pTest.TempDir, "containers.conf")
containersConf := []byte(fmt.Sprintf("[containers]\ndevices = [%s]\n", devices))
err := os.WriteFile(configPath, containersConf, os.ModePerm)
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
// Set custom containers.conf file
os.Setenv("CONTAINERS_CONF", configPath)

View File

@ -2023,7 +2023,7 @@ WORKDIR /madethis`, BB)
bitSize := 1024
keyFileName := filepath.Join(podmanTest.TempDir, "key")
publicKeyFileName, privateKeyFileName, err := WriteRSAKeyPair(keyFileName, bitSize)
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())
imgPath := "localhost:5000/my-alpine"
session = podmanTest.Podman([]string{"push", "--encryption-key", "jwe:" + publicKeyFileName, "--tls-verify=false", "--remove-signatures", ALPINE, imgPath})

View File

@ -156,14 +156,14 @@ var _ = Describe("Common functions test", func() {
bitSize := 1024
publicKeyFileName, privateKeyFileName, err := WriteRSAKeyPair(fileName, bitSize)
Expect(err).To(BeNil(), "Failed to write RSA key pair to files.")
Expect(err).ToNot(HaveOccurred(), "Failed to write RSA key pair to files.")
read, err := os.Open(publicKeyFileName)
Expect(err).To(BeNil(), "Cannot find the public key file after we write it.")
Expect(err).ToNot(HaveOccurred(), "Cannot find the public key file after we write it.")
defer read.Close()
read, err = os.Open(privateKeyFileName)
Expect(err).To(BeNil(), "Cannot find the private key file after we write it.")
Expect(err).ToNot(HaveOccurred(), "Cannot find the private key file after we write it.")
defer read.Close()
})