Skip to content

Commit 807d610

Browse files
authored
[TEST] Added support for SELINUX in functional tests (open-telemetry#3212)
1 parent 40d7b76 commit 807d610

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

functional/otlp/run_test.sh

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,19 @@ export CERT_DIR=../cert
1515

1616
export TEST_BIN_DIR=${BUILD_DIR}/functional/otlp/
1717

18+
# SELINUX
19+
# https://docs.docker.com/storage/bind-mounts/#configure-the-selinux-label
20+
21+
USE_MOUNT_OPTION=""
22+
23+
if [ -x "$(command -v getenforce)" ]; then
24+
SELINUXSTATUS=$(getenforce);
25+
if [ "${SELINUXSTATUS}" == "Enforcing" ]; then
26+
echo "Detected SELINUX"
27+
USE_MOUNT_OPTION=":z"
28+
fi;
29+
fi
30+
1831
${TEST_BIN_DIR}/func_otlp_http --list > test_list.txt
1932

2033
#
@@ -44,7 +57,7 @@ echo ""
4457

4558

4659
docker run -d \
47-
-v `pwd`/otel-docker-config-http.yaml:/otel-cpp/otel-config.yaml \
60+
-v `pwd`/otel-docker-config-http.yaml:/otel-cpp/otel-config.yaml${USE_MOUNT_OPTION} \
4861
-p 4318:4318 \
4962
--name otelcpp-test-http \
5063
otelcpp-func-test
@@ -74,10 +87,10 @@ echo "###############################################################"
7487
echo ""
7588

7689
docker run -d \
77-
-v `pwd`/otel-docker-config-https.yaml:/otel-cpp/otel-config.yaml \
78-
-v `pwd`/../cert/ca.pem:/otel-cpp/ca.pem \
79-
-v `pwd`/../cert/server_cert.pem:/otel-cpp/server_cert.pem \
80-
-v `pwd`/../cert/server_cert-key.pem:/otel-cpp/server_cert-key.pem \
90+
-v `pwd`/otel-docker-config-https.yaml:/otel-cpp/otel-config.yaml${USE_MOUNT_OPTION} \
91+
-v `pwd`/../cert/ca.pem:/otel-cpp/ca.pem${USE_MOUNT_OPTION} \
92+
-v `pwd`/../cert/server_cert.pem:/otel-cpp/server_cert.pem${USE_MOUNT_OPTION} \
93+
-v `pwd`/../cert/server_cert-key.pem:/otel-cpp/server_cert-key.pem${USE_MOUNT_OPTION} \
8194
-p 4318:4318 \
8295
--name otelcpp-test-https \
8396
otelcpp-func-test

0 commit comments

Comments
 (0)