mirror of https://github.com/containers/podman.git
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:
parent
ca40371ff5
commit
8e05caef6c
|
@ -4435,7 +4435,7 @@ cgroups="disabled"`), 0644)
|
||||||
defer os.Unsetenv("CONTAINERS_CONF")
|
defer os.Unsetenv("CONTAINERS_CONF")
|
||||||
os.Setenv("CONTAINERS_CONF", conffile)
|
os.Setenv("CONTAINERS_CONF", conffile)
|
||||||
err = writeYaml(simplePodYaml, kubeYaml)
|
err = writeYaml(simplePodYaml, kubeYaml)
|
||||||
Expect(err).To(BeNil())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
|
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
|
||||||
kube.WaitWithDefaultTimeout()
|
kube.WaitWithDefaultTimeout()
|
||||||
|
|
|
@ -542,7 +542,7 @@ var _ = Describe("Podman prune", func() {
|
||||||
|
|
||||||
// have: containers.json, containers.lock and container dir
|
// have: containers.json, containers.lock and container dir
|
||||||
dirents, err := os.ReadDir(containerStorageDir)
|
dirents, err := os.ReadDir(containerStorageDir)
|
||||||
Expect(err).To(BeNil())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(dirents).To(HaveLen(3))
|
Expect(dirents).To(HaveLen(3))
|
||||||
|
|
||||||
prune := podmanTest.Podman([]string{"system", "prune", "--external", "-f"})
|
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
|
// still have: containers.json, containers.lock and container dir
|
||||||
dirents, err = os.ReadDir(containerStorageDir)
|
dirents, err = os.ReadDir(containerStorageDir)
|
||||||
Expect(err).To(BeNil())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(dirents).To(HaveLen(3))
|
Expect(dirents).To(HaveLen(3))
|
||||||
|
|
||||||
})
|
})
|
||||||
|
@ -574,14 +574,14 @@ var _ = Describe("Podman prune", func() {
|
||||||
|
|
||||||
// containers.json, containers.lock and container 1 dir
|
// containers.json, containers.lock and container 1 dir
|
||||||
dirents, err := os.ReadDir(containerStorageDir)
|
dirents, err := os.ReadDir(containerStorageDir)
|
||||||
Expect(err).To(BeNil())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(dirents).To(HaveLen(3))
|
Expect(dirents).To(HaveLen(3))
|
||||||
|
|
||||||
// Drop podman database and storage, losing track of container 1 (but directory remains)
|
// Drop podman database and storage, losing track of container 1 (but directory remains)
|
||||||
err = os.Remove(filepath.Join(containerStorageDir, "containers.json"))
|
err = os.Remove(filepath.Join(containerStorageDir, "containers.json"))
|
||||||
Expect(err).To(BeNil())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
err = os.RemoveAll(dbDir)
|
err = os.RemoveAll(dbDir)
|
||||||
Expect(err).To(BeNil())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
|
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
|
||||||
|
|
||||||
|
@ -594,7 +594,7 @@ var _ = Describe("Podman prune", func() {
|
||||||
|
|
||||||
// containers.json, containers.lock and container 1&2 dir
|
// containers.json, containers.lock and container 1&2 dir
|
||||||
dirents, err = os.ReadDir(containerStorageDir)
|
dirents, err = os.ReadDir(containerStorageDir)
|
||||||
Expect(err).To(BeNil())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(dirents).To(HaveLen(4))
|
Expect(dirents).To(HaveLen(4))
|
||||||
|
|
||||||
prune := podmanTest.Podman([]string{"system", "prune", "--external", "-f"})
|
prune := podmanTest.Podman([]string{"system", "prune", "--external", "-f"})
|
||||||
|
@ -603,7 +603,7 @@ var _ = Describe("Podman prune", func() {
|
||||||
|
|
||||||
// container 1 dir should be gone now
|
// container 1 dir should be gone now
|
||||||
dirents, err = os.ReadDir(containerStorageDir)
|
dirents, err = os.ReadDir(containerStorageDir)
|
||||||
Expect(err).To(BeNil())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(dirents).To(HaveLen(3))
|
Expect(dirents).To(HaveLen(3))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -567,11 +567,11 @@ var _ = Describe("Podman pull", func() {
|
||||||
bitSize := 1024
|
bitSize := 1024
|
||||||
keyFileName := filepath.Join(podmanTest.TempDir, "key")
|
keyFileName := filepath.Join(podmanTest.TempDir, "key")
|
||||||
publicKeyFileName, privateKeyFileName, err := WriteRSAKeyPair(keyFileName, bitSize)
|
publicKeyFileName, privateKeyFileName, err := WriteRSAKeyPair(keyFileName, bitSize)
|
||||||
Expect(err).To(BeNil())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
wrongKeyFileName := filepath.Join(podmanTest.TempDir, "wrong_key")
|
wrongKeyFileName := filepath.Join(podmanTest.TempDir, "wrong_key")
|
||||||
_, wrongPrivateKeyFileName, err := WriteRSAKeyPair(wrongKeyFileName, bitSize)
|
_, 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 := podmanTest.Podman([]string{"push", "--encryption-key", "jwe:" + publicKeyFileName, "--tls-verify=false", "--remove-signatures", ALPINE, imgPath})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
|
|
|
@ -130,7 +130,7 @@ var _ = Describe("Podman push", func() {
|
||||||
bitSize := 1024
|
bitSize := 1024
|
||||||
keyFileName := filepath.Join(podmanTest.TempDir, "key")
|
keyFileName := filepath.Join(podmanTest.TempDir, "key")
|
||||||
publicKeyFileName, _, err := WriteRSAKeyPair(keyFileName, bitSize)
|
publicKeyFileName, _, err := WriteRSAKeyPair(keyFileName, bitSize)
|
||||||
Expect(err).To(BeNil())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
if !IsRemote() { // Remote does not support --encryption-key
|
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"})
|
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
|
bitSize := 1024
|
||||||
keyFileName := filepath.Join(podmanTest.TempDir, "key")
|
keyFileName := filepath.Join(podmanTest.TempDir, "key")
|
||||||
publicKeyFileName, _, err := WriteRSAKeyPair(keyFileName, bitSize)
|
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 := podmanTest.Podman([]string{"push", "--encryption-key", "jwe:" + publicKeyFileName, ALPINE, fmt.Sprintf("oci:%s", bbdir)})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
|
|
|
@ -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 {
|
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]
|
op := check[0]
|
||||||
args := make([]string, 0)
|
args := make([]string, 0)
|
||||||
for _, a := range check[1:] {
|
for _, a := range check[1:] {
|
||||||
|
|
|
@ -16,7 +16,7 @@ func createContainersConfFileWithDevices(pTest *PodmanTestIntegration, devices s
|
||||||
configPath := filepath.Join(pTest.TempDir, "containers.conf")
|
configPath := filepath.Join(pTest.TempDir, "containers.conf")
|
||||||
containersConf := []byte(fmt.Sprintf("[containers]\ndevices = [%s]\n", devices))
|
containersConf := []byte(fmt.Sprintf("[containers]\ndevices = [%s]\n", devices))
|
||||||
err := os.WriteFile(configPath, containersConf, os.ModePerm)
|
err := os.WriteFile(configPath, containersConf, os.ModePerm)
|
||||||
Expect(err).To(BeNil())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
// Set custom containers.conf file
|
// Set custom containers.conf file
|
||||||
os.Setenv("CONTAINERS_CONF", configPath)
|
os.Setenv("CONTAINERS_CONF", configPath)
|
||||||
|
|
|
@ -2023,7 +2023,7 @@ WORKDIR /madethis`, BB)
|
||||||
bitSize := 1024
|
bitSize := 1024
|
||||||
keyFileName := filepath.Join(podmanTest.TempDir, "key")
|
keyFileName := filepath.Join(podmanTest.TempDir, "key")
|
||||||
publicKeyFileName, privateKeyFileName, err := WriteRSAKeyPair(keyFileName, bitSize)
|
publicKeyFileName, privateKeyFileName, err := WriteRSAKeyPair(keyFileName, bitSize)
|
||||||
Expect(err).To(BeNil())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
imgPath := "localhost:5000/my-alpine"
|
imgPath := "localhost:5000/my-alpine"
|
||||||
session = podmanTest.Podman([]string{"push", "--encryption-key", "jwe:" + publicKeyFileName, "--tls-verify=false", "--remove-signatures", ALPINE, imgPath})
|
session = podmanTest.Podman([]string{"push", "--encryption-key", "jwe:" + publicKeyFileName, "--tls-verify=false", "--remove-signatures", ALPINE, imgPath})
|
||||||
|
|
|
@ -156,14 +156,14 @@ var _ = Describe("Common functions test", func() {
|
||||||
bitSize := 1024
|
bitSize := 1024
|
||||||
|
|
||||||
publicKeyFileName, privateKeyFileName, err := WriteRSAKeyPair(fileName, bitSize)
|
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)
|
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()
|
defer read.Close()
|
||||||
|
|
||||||
read, err = os.Open(privateKeyFileName)
|
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()
|
defer read.Close()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue