Skip to content

Commit

Permalink
Merge pull request #16900 from Luap99/gingkolinter
Browse files Browse the repository at this point in the history
ginkgo tests: apply ginkgolinter fixes
  • Loading branch information
openshift-merge-robot authored Dec 20, 2022
2 parents c2d48c5 + 8e05cae commit aecb5d3
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion test/e2e/play_kube_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
14 changes: 7 additions & 7 deletions test/e2e/prune_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"})
Expand All @@ -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))

})
Expand All @@ -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))

Expand All @@ -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"})
Expand All @@ -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))
})
})
4 changes: 2 additions & 2 deletions test/e2e/pull_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/push_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"})
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/quadlet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:] {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/run_device_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
6 changes: 3 additions & 3 deletions test/utils/common_function_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})

Expand Down

0 comments on commit aecb5d3

Please sign in to comment.