diff --git a/Makefile b/Makefile index 567a871b0..541d68d82 100644 --- a/Makefile +++ b/Makefile @@ -323,6 +323,14 @@ test-upgrade: $(JUNITREPORT) IMAGE_LOGGING_EVENTROUTER=$(IMAGE_LOGGING_EVENTROUTER) \ exit 0 +.PHONY: test-e2e-from-ci-bundle +test-e2e-from-ci-bundle: $(JUNITREPORT) + RELATED_IMAGE_VECTOR=$(IMAGE_LOGGING_VECTOR) \ + RELATED_IMAGE_LOG_FILE_METRIC_EXPORTER=$(IMAGE_LOGFILEMETRICEXPORTER) \ + IMAGE_LOGGING_EVENTROUTER=$(IMAGE_LOGGING_EVENTROUTER) \ + IMAGE_TLS_SCANNER=$(IMAGE_TLS_SCANNER) \ + LOG_LEVEL=3 hack/test-e2e-from-ci-bundle.sh + .PHONY: test-e2e test-e2e: $(JUNITREPORT) RELATED_IMAGE_VECTOR=$(IMAGE_LOGGING_VECTOR) \ diff --git a/hack/test-e2e-from-ci-bundle.sh b/hack/test-e2e-from-ci-bundle.sh new file mode 100755 index 000000000..1be5c3be5 --- /dev/null +++ b/hack/test-e2e-from-ci-bundle.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +set -euo pipefail + +repo_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +cd "$repo_dir" + +CLUSTER_LOGGING_OPERATOR_NAMESPACE=${CLUSTER_LOGGING_OPERATOR_NAMESPACE:-openshift-logging} + +oc label ns/"${CLUSTER_LOGGING_OPERATOR_NAMESPACE}" openshift.io/cluster-monitoring=true --overwrite +oc label ns/"${CLUSTER_LOGGING_OPERATOR_NAMESPACE}" pod-security.kubernetes.io/enforce=privileged --overwrite +oc label ns/"${CLUSTER_LOGGING_OPERATOR_NAMESPACE}" pod-security.kubernetes.io/audit=privileged --overwrite +oc label ns/"${CLUSTER_LOGGING_OPERATOR_NAMESPACE}" pod-security.kubernetes.io/warn=privileged --overwrite + +GOFLAGS=-mod=mod go test -p 1 -v -timeout=90m ./test/e2e/... \ + -ginkgo.v -ginkgo.trace -ginkgo.no-color \ + -ginkgo.skip="FlowControl" \ + -ginkgo.poll-progress-after=300s \ + -ginkgo.poll-progress-interval=30s diff --git a/test/e2e/collection/security/container_security_test.go b/test/e2e/collection/security/container_security_test.go index 5ba0bb985..db16750e5 100644 --- a/test/e2e/collection/security/container_security_test.go +++ b/test/e2e/collection/security/container_security_test.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "runtime" + "strings" "time" internalruntime "github.com/openshift/cluster-logging-operator/internal/runtime" @@ -36,6 +37,10 @@ var _ = Describe("Tests of collector container security stance", func() { checkMountReadOnly = func(mount string) { touchFile := mount + "/1" result, err := runInCollectorContainer("touch", touchFile) + if err != nil && strings.Contains(result, "No such file or directory") { + log.V(0).Info("Mount path does not exist on this node, skipping read-only check", "mount", mount) + return + } Expect(result).To(MatchRegexp("touch:.cannot.*touch.*" + touchFile + ".*Read-only file system")) Expect(err).To(MatchError(ContainSubstring("exit status 1"))) }