Skip to content

Commit 43adf28

Browse files
committed
Scripts and dockerfile
1 parent 5c9fe7d commit 43adf28

File tree

3 files changed

+54
-5
lines changed

3 files changed

+54
-5
lines changed

functional/otlp/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
FROM otel/opentelemetry-collector
55
COPY . .
66
CMD ["--config", "/otel-cpp/otel-config.yaml"]
7+
EXPOSE 4317
78
EXPOSE 4318

functional/otlp/run_test.sh

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

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

18+
export TEST_EXECUTABLE="func_otlp_http"
19+
export TEST_URL="localhost:4318/v1/traces"
20+
1821
# SELINUX
1922
# https://docs.docker.com/storage/bind-mounts/#configure-the-selinux-label
2023

@@ -109,6 +112,47 @@ echo ""
109112
docker stop otelcpp-test-https
110113
docker rm otelcpp-test-https
111114

115+
116+
#
117+
# Switch to exercising gRPC functional tests
118+
#
119+
export TEST_EXECUTABLE="func_otlp_grpc"
120+
export TEST_URL="localhost:4317"
121+
122+
#
123+
# MODE 'SSL'
124+
#
125+
126+
echo ""
127+
echo "###############################################################"
128+
echo "Starting otelcol --config otel-config-https-mtls.yaml"
129+
echo "###############################################################"
130+
echo ""
131+
132+
docker run -d \
133+
-v `pwd`/otel-docker-config-https-mtls.yaml:/otel-cpp/otel-config-mtls.yaml${USE_MOUNT_OPTION} \
134+
-v `pwd`/../cert/ca.pem:/otel-cpp/ca.pem${USE_MOUNT_OPTION} \
135+
-v `pwd`/../cert/client_cert.pem:/otel-cpp/client_cert.pem${USE_MOUNT_OPTION} \
136+
-v `pwd`/../cert/server_cert.pem:/otel-cpp/server_cert.pem${USE_MOUNT_OPTION} \
137+
-v `pwd`/../cert/server_cert-key.pem:/otel-cpp/server_cert-key.pem${USE_MOUNT_OPTION} \
138+
-p 4317:4317 \
139+
--name otelcpp-test-grpc-mtls \
140+
otelcpp-func-test
141+
142+
sleep 5;
143+
144+
export SERVER_MODE="https"
145+
./run_test_mode.sh
146+
147+
echo ""
148+
echo "###############################################################"
149+
echo "Stopping otelcol (https / mTLS)"
150+
echo "###############################################################"
151+
echo ""
152+
153+
docker stop otelcpp-test-grpc-mtls
154+
docker rm otelcpp-test-grpc-mtls
155+
112156
echo ""
113157
echo "###############################################################"
114158
echo "TEST REPORT"

functional/otlp/run_test_mode.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,31 @@ set -e
2222

2323
[ -z "${SERVER_MODE}" ] && export SERVER_MODE="none"
2424

25+
[ -z "${TEST_EXECUTABLE}" ] && echo "Please specify TEST_EXECUTABLE name" && exit 1
26+
27+
[ -z "${TEST_URL}" ] && echo "Please specify TEST_URL endpoint (without scheme)" && exit 1
28+
2529
export CERT_DIR=../cert
2630

2731
export TEST_BIN_DIR=${BUILD_DIR}/functional/otlp/
2832

29-
${TEST_BIN_DIR}/func_otlp_http --list > test_list.txt
33+
${TEST_BIN_DIR}/${TEST_EXECUTABLE} --list > test_list.txt
3034

3135
export TEST_FULL_NAME=""
3236

3337
#
3438
# Connect with no security
3539
#
3640

37-
export TEST_ENDPOINT="http://localhost:4318/v1/traces"
41+
export TEST_ENDPOINT="http://${TEST_URL}"
3842
export TEST_RUN="insecure"
3943

4044
for T in `cat test_list.txt`
4145
do
4246
echo "====================================================================="
4347
echo "Running test ${T} on ${TEST_RUN} ${TEST_ENDPOINT} with server ${SERVER_MODE}"
4448
TEST_FULL_NAME="${T}-${TEST_RUN}-${SERVER_MODE}"
45-
${TEST_BIN_DIR}/func_otlp_http --debug --mode ${SERVER_MODE} --cert-dir ${CERT_DIR} --endpoint ${TEST_ENDPOINT} ${T}
49+
${TEST_BIN_DIR}/${TEST_EXECUTABLE} --debug --mode ${SERVER_MODE} --cert-dir ${CERT_DIR} --endpoint ${TEST_ENDPOINT} ${T}
4650
RC=$?
4751
if [ ${RC} -eq 0 ]; then
4852
echo "TEST ${TEST_FULL_NAME}: PASSED" | tee -a report.log
@@ -55,15 +59,15 @@ done
5559
# Connect with security
5660
#
5761

58-
export TEST_ENDPOINT="https://localhost:4318/v1/traces"
62+
export TEST_ENDPOINT="https://${TEST_URL}"
5963
export TEST_RUN="secure"
6064

6165
for T in `cat test_list.txt`
6266
do
6367
echo "====================================================================="
6468
echo "Running test ${T} on ${TEST_RUN} ${TEST_ENDPOINT} with server ${SERVER_MODE}"
6569
TEST_FULL_NAME="${T}-${TEST_RUN}-${SERVER_MODE}"
66-
${TEST_BIN_DIR}/func_otlp_http --debug --mode ${SERVER_MODE} --cert-dir ${CERT_DIR} --endpoint ${TEST_ENDPOINT} ${T}
70+
${TEST_BIN_DIR}/${TEST_EXECUTABLE} --debug --mode ${SERVER_MODE} --cert-dir ${CERT_DIR} --endpoint ${TEST_ENDPOINT} ${T}
6771
RC=$?
6872
if [ ${RC} -eq 0 ]; then
6973
echo "TEST ${TEST_FULL_NAME}: PASSED" | tee -a report.log

0 commit comments

Comments
 (0)