-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun_test.sh
More file actions
executable file
·111 lines (89 loc) · 2.77 KB
/
run_test.sh
File metadata and controls
executable file
·111 lines (89 loc) · 2.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/bash
# Get the test parameter
TEST_PARAM="$1"
# Check if parameter is passed
if [ -z "$TEST_PARAM" ]; then
echo "Error: No test parameter provided"
echo "Usage: ./run_test.sh <test_parameter>"
echo "Available tests:"
echo " - batch_processor"
echo " - otlp_batcher"
echo " - cleanup"
exit 1
fi
# Validate parameter against allowed values
ALLOWED_PARAMS=("batch_processor" "otlp_batcher" "cleanup")
if [[ ! " ${ALLOWED_PARAMS[@]} " =~ " ${TEST_PARAM} " ]]; then
echo "Error: Invalid test parameter '$TEST_PARAM'"
echo "Available tests:"
echo " - batch_processor"
echo " - otlp_batcher"
echo " - cleanup"
exit 1
fi
# Handle cleanup
if [ "$TEST_PARAM" = "cleanup" ]; then
echo "====================================="
echo "Running cleanup..."
echo "====================================="
echo ""
echo "Stopping and removing all docker compose services..."
docker compose --profile batch_processor --profile otlp_batcher down
echo ""
echo "Cleaning up file storage directories..."
rm -rf otelcol-batch_processor/file_storage/*
rm -rf otelcol-otlp_batcher/file_storage/*
echo ""
echo "====================================="
echo "Cleanup complete!"
echo "====================================="
exit 0
fi
echo "Running $TEST_PARAM test"
echo "Cleaning up file storage to start fresh"
rm -rf "otelcol-${TEST_PARAM}/file_storage/*"
echo "Starting the demo services"
docker compose --profile "${TEST_PARAM}" up -d
echo "Docker compose started."
echo ""
echo "Sleep for 5 seconds"
for i in {1..5}; do
sleep 1
echo -n "."
done
echo ""
echo "Sending 100 traces to the Collector"
# Send 100 traces
docker run --rm --network=crash-proofing \
ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:v0.150.0 \
traces \
--otlp-insecure \
--otlp-endpoint otel-collector:4317 \
--rate 0 \
--traces 100
echo "Waiting for 15 seconds before killing the Collector"
for i in {1..15}; do
sleep 1
echo -n "."
done
echo ""
echo "Killing the Collector"
# Kill the container
docker kill otel-collector
echo "Collector killed."
echo ""
echo "Navigate to the Jaeger to view that no data was sent."
echo "Jaeger: http://localhost:16686"
echo ""
echo "====================================="
echo "Whenever ready, run the following command to start the Collector again:"
echo "docker compose --profile ${TEST_PARAM} up otelcol-${TEST_PARAM} -d"
echo "====================================="
echo ""
echo "After the Collector is running again, navigate to the Jaeger to view if you get any traces."
echo ""
echo ""
echo "====================================="
echo "When you're done, run cleanup with:"
echo "./run_test.sh cleanup"
echo "====================================="