From df13eebfd027c2a760b3cda71a76641fe01af3a1 Mon Sep 17 00:00:00 2001 From: Harshal Patil Date: Wed, 21 Apr 2021 13:48:32 +0530 Subject: [PATCH] Add SELinux security context to ContainerLogPath test Signed-off-by: Harshal Patil --- test/e2e_node/log_path_test.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/e2e_node/log_path_test.go b/test/e2e_node/log_path_test.go index 9d7740a96a6..cfdd9823cb1 100644 --- a/test/e2e_node/log_path_test.go +++ b/test/e2e_node/log_path_test.go @@ -18,6 +18,7 @@ package e2enode import ( "context" + v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/uuid" @@ -74,7 +75,12 @@ var _ = SIGDescribe("ContainerLogPath [NodeConformance]", func() { Containers: []v1.Container{ { Image: busyboxImage, - Name: podName, + SecurityContext: &v1.SecurityContext{ + SELinuxOptions: &v1.SELinuxOptions{ + Type: "container_logreader_t", + }, + }, + Name: podName, // If we find expected log file and contains right content, exit 0 // else, keep checking until test timeout Command: []string{"sh", "-c", "while true; do if [ -e " + expectedLogPath + " ] && grep -q " + log + " " + expectedLogPath + "; then exit 0; fi; sleep 1; done"},