diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go index 6d752279fc..b0385d22a7 100644 --- a/test/e2e/play_kube_test.go +++ b/test/e2e/play_kube_test.go @@ -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() diff --git a/test/e2e/prune_test.go b/test/e2e/prune_test.go index fb7265f07d..906170b6eb 100644 --- a/test/e2e/prune_test.go +++ b/test/e2e/prune_test.go @@ -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)) }) }) diff --git a/test/e2e/pull_test.go b/test/e2e/pull_test.go index e2769098b1..60dc659c6b 100644 --- a/test/e2e/pull_test.go +++ b/test/e2e/pull_test.go @@ -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() diff --git a/test/e2e/push_test.go b/test/e2e/push_test.go index cb65b6db8b..05b47bc939 100644 --- a/test/e2e/push_test.go +++ b/test/e2e/push_test.go @@ -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() diff --git a/test/e2e/quadlet_test.go b/test/e2e/quadlet_test.go index c2a03fb094..eed3afb97e 100644 --- a/test/e2e/quadlet_test.go +++ b/test/e2e/quadlet_test.go @@ -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:] { diff --git a/test/e2e/run_device_test.go b/test/e2e/run_device_test.go index 2d1ce010a8..44e8fbd952 100644 --- a/test/e2e/run_device_test.go +++ b/test/e2e/run_device_test.go @@ -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) diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index f1ebf48224..5f8af05e9f 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -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}) diff --git a/test/utils/common_function_test.go b/test/utils/common_function_test.go index 361f89077e..3e75f4f736 100644 --- a/test/utils/common_function_test.go +++ b/test/utils/common_function_test.go @@ -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() })