Skip to content

Commit

Permalink
Printed setup info in do_kafka_test.sh and added timeout to python …
Browse files Browse the repository at this point in the history
…script calls in `do_bsm_test.sh` & `do_tim_test.sh`
  • Loading branch information
dmccoystephenson committed Jul 20, 2023
1 parent 69af1ac commit bb0f062
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
12 changes: 12 additions & 0 deletions do_kafka_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ setup() {
exit 1
fi

# print setup info
echo "=== Setup Info ==="
echo "DOCKER_HOST_IP: $DOCKER_HOST_IP"
echo "KAFKA_CONTAINER_NAME: $KAFKA_CONTAINER_NAME"
echo "MAP_FILE: $MAP_FILE"
echo "BSM_DATA_FILE: $BSM_DATA_FILE"
echo "TIM_DATA_FILE: $TIM_DATA_FILE"
echo "PPM_CONTAINER_NAME: $PPM_CONTAINER_NAME"
echo "PPM_IMAGE_TAG: $PPM_IMAGE_TAG"
echo "PPM_IMAGE_NAME: $PPM_IMAGE_NAME"
echo "=================="

./start_kafka.sh
}

Expand Down
11 changes: 8 additions & 3 deletions docker-test/do_bsm_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,18 @@ max_attempts=5
while true; do
attempts=$((attempts+1))

/cvdi-stream-build/kafka-test/kafka_tool -C -b $broker -p 0 -t topic.FilteredOdeBsmJson -e -o $offset 2> con.err | /cvdi-stream/docker-test/test_out.py > tmp.out
timeout 5 /cvdi-stream-build/kafka-test/kafka_tool -C -b $broker -p 0 -t topic.FilteredOdeBsmJson -e -o $offset 2> con.err | /cvdi-stream/docker-test/test_out.py > tmp.out
if [[ $? != 0 ]]; then
echo "Error: Kafka consumer timed out."
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo -e $RED"TEST FAILED!"$NC
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~"
exit 1
fi

lines=$(cat tmp.out | wc -l)

if [[ $lines != "0" ]]; then
cat tmp.out

break
else
if [[ $attempts > $max_attempts ]]; then
Expand Down
11 changes: 8 additions & 3 deletions docker-test/do_tim_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,18 @@ max_attempts=5
while true; do
attempts=$((attempts+1))

/cvdi-stream-build/kafka-test/kafka_tool -C -b $broker -p 0 -t topic.FilteredOdeTimJson -e -o $offset 2> con.err | /cvdi-stream/docker-test/test_out.py > tmp.out
timeout 5 /cvdi-stream-build/kafka-test/kafka_tool -C -b $broker -p 0 -t topic.FilteredOdeTimJson -e -o $offset 2> con.err | /cvdi-stream/docker-test/test_out.py > tmp.out
if [[ $? != 0 ]]; then
echo "Error: Kafka consumer timed out."
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo -e $RED"TEST FAILED!"$NC
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~"
exit 1
fi

lines=$(cat tmp.out | wc -l)

if [[ $lines != "0" ]]; then
cat tmp.out

break
else
if [[ $attempts > $max_attempts ]]; then
Expand Down

0 comments on commit bb0f062

Please sign in to comment.