summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pkg/domain/infra/abi/play.go5
-rw-r--r--test/e2e/play_kube_test.go2
-rw-r--r--test/system/271-tcp-cors-server.bats44
3 files changed, 49 insertions, 2 deletions
diff --git a/pkg/domain/infra/abi/play.go b/pkg/domain/infra/abi/play.go
index 4782f0d01..d257bad18 100644
--- a/pkg/domain/infra/abi/play.go
+++ b/pkg/domain/infra/abi/play.go
@@ -277,7 +277,10 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY
// registry on localhost.
pullPolicy := config.PullPolicyNewer
if len(container.ImagePullPolicy) > 0 {
- pullPolicy, err = config.ParsePullPolicy(string(container.ImagePullPolicy))
+ // Make sure to lower the strings since K8s pull policy
+ // may be capitalized (see bugzilla.redhat.com/show_bug.cgi?id=1985905).
+ rawPolicy := string(container.ImagePullPolicy)
+ pullPolicy, err = config.ParsePullPolicy(strings.ToLower(rawPolicy))
if err != nil {
return nil, err
}
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go
index 5e303bf2f..66bfdefe7 100644
--- a/test/e2e/play_kube_test.go
+++ b/test/e2e/play_kube_test.go
@@ -1729,7 +1729,7 @@ var _ = Describe("Podman play kube", func() {
})
It("podman play kube with pull policy of missing", func() {
- ctr := getCtr(withPullPolicy("missing"), withImage(BB))
+ ctr := getCtr(withPullPolicy("Missing"), withImage(BB))
err := generateKubeYaml("pod", getPod(withCtr(ctr)), kubeYaml)
Expect(err).To(BeNil())
diff --git a/test/system/271-tcp-cors-server.bats b/test/system/271-tcp-cors-server.bats
new file mode 100644
index 000000000..cdfa82e82
--- /dev/null
+++ b/test/system/271-tcp-cors-server.bats
@@ -0,0 +1,44 @@
+#!/usr/bin/env bats -*- bats -*-
+#
+# Tests podman system service CORS enabled
+#
+
+load helpers
+
+SERVICE_NAME="podman_test_$(random_string)"
+
+SERVICE_TCP_HOST="localhost"
+
+SERVICE_FILE="$UNIT_DIR/$SERVICE_NAME.service"
+SOCKET_FILE="$UNIT_DIR/$SERVICE_NAME.socket"
+
+@test "podman system service - tcp CORS" {
+ skip_if_remote "system service tests are meaningless over remote"
+ PORT=$(( ((RANDOM<<15)|RANDOM) % 63001 + 2000 ))
+ run_podman system service --cors="*" tcp:$SERVICE_TCP_HOST:$PORT -t 20 &
+ podman_pid="$!"
+ sleep 5s
+ run curl -s --max-time 10 -vvv $SERVICE_TCP_HOST:$PORT/_ping 2>&1
+ is "$output" ".*< Access-Control-Allow-Origin: \*.*" "access-control-allow-origin verifies CORS is set"
+ kill $podman_pid
+ wait $podman_pid || true
+}
+
+@test "podman system service - tcp without CORS" {
+ skip_if_remote "system service tests are meaningless over remote"
+ PORT=$(( ((RANDOM<<15)|RANDOM) % 63001 + 2000 ))
+ run_podman system service tcp:$SERVICE_TCP_HOST:$PORT -t 20 &
+ podman_pid="$!"
+ sleep 5s
+ (curl -s --max-time 10 -vvv $SERVICE_TCP_HOST:$PORT/_ping 2>&1 | grep -Eq "Access-Control-Allow-Origin:") && false || true
+ kill $podman_pid
+ wait $podman_pid || true
+}
+
+@test "podman system service - CORS enabled in logs" {
+ skip_if_remote "system service tests are meaningless over remote"
+ run_podman system service --log-level="debug" --cors="*" -t 1
+ is "$output" ".*CORS Headers were set to \*.*" "debug log confirms CORS headers set"
+}
+
+# vim: filetype=sh