Merge pull request #20976 from Luap99/string-array

cli: use StringArray over StringSlice Part 2
This commit is contained in:
openshift-merge-bot[bot]
2023-12-13 12:22:31 +00:00
committed by GitHub
11 changed files with 26 additions and 19 deletions

View File

@@ -314,7 +314,7 @@ add_compression = ["zstd"]`), 0o644)
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(125))
Expect(session.ErrorToString()).To(ContainSubstring("no value given for annotation"))
session = podmanTest.Podman([]string{"manifest", "add", "--annotation", "hoge=fuga", "foo", imageList})
session = podmanTest.Podman([]string{"manifest", "add", "--annotation", "hoge=fuga", "--annotation", "key=val,withcomma", "foo", imageList})
session.WaitWithDefaultTimeout()
Expect(session).Should(ExitCleanly())
session = podmanTest.Podman([]string{"manifest", "inspect", "foo"})
@@ -324,7 +324,7 @@ add_compression = ["zstd"]`), 0o644)
var inspect define.ManifestListData
err := json.Unmarshal(session.Out.Contents(), &inspect)
Expect(err).ToNot(HaveOccurred())
Expect(inspect.Manifests[0].Annotations).To(Equal(map[string]string{"hoge": "fuga"}))
Expect(inspect.Manifests[0].Annotations).To(Equal(map[string]string{"hoge": "fuga", "key": "val,withcomma"}))
})
It("add --os", func() {
@@ -347,7 +347,7 @@ add_compression = ["zstd"]`), 0o644)
session = podmanTest.Podman([]string{"manifest", "add", "foo", imageListInstance})
session.WaitWithDefaultTimeout()
Expect(session).Should(ExitCleanly())
session = podmanTest.Podman([]string{"manifest", "annotate", "--annotation", "hello=world", "--arch", "bar", "foo", imageListARM64InstanceDigest})
session = podmanTest.Podman([]string{"manifest", "annotate", "--annotation", "hello=world,withcomma", "--arch", "bar", "foo", imageListARM64InstanceDigest})
session.WaitWithDefaultTimeout()
Expect(session).Should(ExitCleanly())
session = podmanTest.Podman([]string{"manifest", "inspect", "foo"})
@@ -355,7 +355,7 @@ add_compression = ["zstd"]`), 0o644)
Expect(session).Should(ExitCleanly())
Expect(session.OutputToString()).To(ContainSubstring(`"architecture": "bar"`))
// Check added annotation
Expect(session.OutputToString()).To(ContainSubstring(`"hello": "world"`))
Expect(session.OutputToString()).To(ContainSubstring(`"hello": "world,withcomma"`))
})
It("remove digest", func() {

View File

@@ -4886,7 +4886,7 @@ ENV OPENJ9_JAVA_OPTIONS=%q
err := generateKubeYaml("pod", pod, kubeYaml)
Expect(err).ToNot(HaveOccurred())
kube := podmanTest.Podman([]string{"kube", "play", kubeYaml, "--log-driver", "journald", "--log-opt", "tag={{.ImageName}}"})
kube := podmanTest.Podman([]string{"kube", "play", kubeYaml, "--log-driver", "journald", "--log-opt", "tag={{.ImageName}},withcomma"})
kube.WaitWithDefaultTimeout()
Expect(kube).Should(ExitCleanly())
@@ -4897,7 +4897,7 @@ ENV OPENJ9_JAVA_OPTIONS=%q
inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod)})
inspect.WaitWithDefaultTimeout()
Expect(start).Should(ExitCleanly())
Expect((inspect.InspectContainerToJSON()[0]).HostConfig.LogConfig.Tag).To(Equal("{{.ImageName}}"))
Expect((inspect.InspectContainerToJSON()[0]).HostConfig.LogConfig.Tag).To(Equal("{{.ImageName}},withcomma"))
})
It("using a user namespace", func() {

View File

@@ -612,7 +612,7 @@ var _ = Describe("Podman pull", func() {
decryptionTestHelper := func(imgPath string) *PodmanSessionIntegration {
bitSize := 1024
keyFileName := filepath.Join(podmanTest.TempDir, "key")
keyFileName := filepath.Join(podmanTest.TempDir, "key,withcomma")
publicKeyFileName, privateKeyFileName, err := WriteRSAKeyPair(keyFileName, bitSize)
Expect(err).ToNot(HaveOccurred())

View File

@@ -2152,7 +2152,7 @@ WORKDIR /madethis`, BB)
}
bitSize := 1024
keyFileName := filepath.Join(podmanTest.TempDir, "key")
keyFileName := filepath.Join(podmanTest.TempDir, "key,withcomma")
publicKeyFileName, privateKeyFileName, err := WriteRSAKeyPair(keyFileName, bitSize)
Expect(err).ToNot(HaveOccurred())

View File

@@ -435,11 +435,18 @@ _EOF
@test "podman kube --annotation" {
TESTDIR=$PODMAN_TMPDIR/testdir
RANDOMSTRING=$(random_string 15)
ANNOTATION_WITH_COMMA="comma,$(random_string 5)"
mkdir -p $TESTDIR
echo "$testYaml" | sed "s|TESTDIR|${TESTDIR}|g" > $PODMAN_TMPDIR/test.yaml
run_podman kube play --annotation "name=$RANDOMSTRING" $PODMAN_TMPDIR/test.yaml
run_podman kube play --annotation "name=$RANDOMSTRING" \
--annotation "anno=$ANNOTATION_WITH_COMMA" $PODMAN_TMPDIR/test.yaml
run_podman inspect --format "{{ .Config.Annotations }}" test_pod-test
is "$output" ".*name:$RANDOMSTRING" "Annotation should be added to pod"
is "$output" ".*anno:$ANNOTATION_WITH_COMMA" "Annotation with comma should be added to pod"
# invalid annotation
run_podman 125 kube play --annotation "val" $PODMAN_TMPDIR/test.yaml
assert "$output" == "Error: annotation \"val\" must include an '=' sign" "invalid annotation error"
run_podman stop -a -t 0
run_podman pod rm -t 0 -f test_pod
@@ -692,7 +699,7 @@ spec:
}
@test "podman kube play with configmaps" {
configmap_file=${PODMAN_TMPDIR}/play_kube_configmap_configmaps$(random_string 6).yaml
configmap_file=${PODMAN_TMPDIR}/play_kube_configmap_configmaps$(random_string 6),withcomma.yaml
echo "
---
apiVersion: v1