Skip to content

Commit ad7fcd1

Browse files
committed
Fix retry mechanism in FV/Nv online tests
Changed way we call retry in shell Relates-to: OLPEDGE-1144 Signed-off-by: Yaroslav Stefinko <[email protected]>
1 parent 6dd1dd5 commit ad7fcd1

File tree

3 files changed

+59
-36
lines changed

3 files changed

+59
-36
lines changed

scripts/linux/fv/gitlab-olp-cpp-sdk-functional-test.sh

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -33,32 +33,12 @@ do
3333
sleep 0.15
3434
set -e
3535
done
36-
result=0
36+
3737
echo ">>> Functional Test ... >>>"
3838
source $FV_HOME/olp-cpp-sdk-functional-test.variables
3939
$REPO_HOME/build/tests/functional/olp-cpp-sdk-functional-tests \
4040
--gtest_output="xml:$REPO_HOME/reports/olp-functional-test-report.xml" \
4141
--gtest_filter="-ArcGisAuthenticationTest.SignInArcGis":"FacebookAuthenticationTest.SignInFacebook"
42-
result=$?
43-
echo "Last return code in $result"
44-
45-
# Add retry to functional/online tests. Some online tests are flaky due to third party reason
46-
# Test failure should return code 1
47-
retry_count=0
48-
while [[ ${result} = 1 ]];
49-
do
50-
retry_count=$((retry_count+1)) && echo "This is ${retry_count} time retry ..."
51-
$REPO_HOME/build/tests/functional/olp-cpp-sdk-functional-tests \
52-
--gtest_output="xml:$REPO_HOME/reports/olp-functional-test-report.xml" \
53-
--gtest_filter="-ArcGisAuthenticationTest.SignInArcGis":"FacebookAuthenticationTest.SignInFacebook"
54-
result=$?
55-
56-
# Stop after 3 retry
57-
if [[ ${retry_count} = 3 ]]; then
58-
break
59-
fi
60-
done
61-
# End of retry part. This part can be removed anytime.
6242

6343
# Kill local server
6444
kill -15 ${SERVER_PID}

scripts/linux/fv/gitlab_test_fv.sh

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash -e
1+
#!/bin/bash -ex
22
#
33
# Copyright (C) 2019 HERE Europe B.V.
44
#
@@ -29,6 +29,7 @@ if [ -z $production_service_secret ] || [ -z $production_service_id ] ; then
2929
fi
3030

3131
TEST_FAILURE=0
32+
RETRY_COUNT=0
3233
EXPECTED_REPORT_COUNT=6 # expected that we generate 6 reports
3334

3435
#for core dump backtrace
@@ -42,7 +43,35 @@ ${FV_HOME}/gitlab-olp-cpp-sdk-dataservice-read-test.sh 2>> errors.txt || TEST_FA
4243
${FV_HOME}/gitlab-olp-cpp-sdk-dataservice-write-test.sh 2>> errors.txt || TEST_FAILURE=1
4344

4445
# Run functional tests
45-
${FV_HOME}/gitlab-olp-cpp-sdk-functional-test.sh 2>> errors.txt || TEST_FAILURE=1
46+
# Add retry to functional/online tests. Some online tests are flaky due to third party reason
47+
# Test failure must return code 1 only. Other return code are not handled in retry.
48+
# Allowing tests failures (exit codes not 0) for online tests is done by set command below. Process is controlled by retry mechanism below.
49+
set +e
50+
while true
51+
do
52+
# Stop after 3 retry
53+
if [[ ${RETRY_COUNT} -eq 3 ]]; then
54+
echo "Reach limit (${RETRY_COUNT}) of retries ..."
55+
break
56+
fi
57+
58+
RETRY_COUNT=$((RETRY_COUNT+1))
59+
echo "This is ${RETRY_COUNT} time retry ..."
60+
61+
# Run functional tests
62+
${FV_HOME}/gitlab-olp-cpp-sdk-functional-test.sh 2>> errors.txt
63+
if [[ $? -eq 1 ]]; then
64+
TEST_FAILURE=1
65+
continue
66+
else
67+
# Return to success
68+
TEST_FAILURE=0
69+
break
70+
fi
71+
done
72+
set -e
73+
# End of retry part. This part can be removed anytime.
74+
4675

4776
# Run integration tests
4877
${FV_HOME}/gitlab-olp-cpp-sdk-integration-test.sh 2>> errors.txt || TEST_FAILURE=1

scripts/linux/nv/gitlab_test_valgrind.sh

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash -e
1+
#!/bin/bash -ex
22
#
33
# Copyright (C) 2019 HERE Europe B.V.
44
#
@@ -85,20 +85,34 @@ do
8585
echo "-----> Finished ${test_group_name} - Result=${result}"
8686

8787
# Add retry to functional/online tests. Some online tests are flaky due to third party reason
88-
# Test failure should return code 1
89-
retry_count=0
90-
while [[ ${result} = 1 && ${test_group_name} == "functional" ]];
88+
# Test failure must return code 1 only. Other return code are not handled in retry.
89+
RETRY_COUNT=0
90+
while true
9191
do
92-
retry_count=$((retry_count+1)) && echo "This is ${retry_count} time retry ..."
93-
echo "-----> Calling \"${test_command}\" for ${test_group_name} : "
94-
eval "${test_command}"
95-
result=$?
96-
echo "-----> Finished ${test_group_name} - Result=${result}"
97-
98-
# Stop after 3 retry
99-
if [[ ${retry_count} = 3 ]]; then
100-
break
92+
if [[ ${test_group_name} == "functional" ]]; then
93+
# Stop after 3 retry
94+
if [[ ${RETRY_COUNT} -eq 3 ]]; then
95+
echo "Reach limit (${RETRY_COUNT}) of retries ..."
96+
break
97+
fi
98+
RETRY_COUNT=$((RETRY_COUNT+1))
99+
echo "This is ${RETRY_COUNT} time retry ..."
100+
101+
# Run functional tests
102+
echo "-----> Calling \"${test_command}\" for ${test_group_name} : "
103+
eval "${test_command}"
104+
result=$?
105+
echo "-----> Finished ${test_group_name} - Result=${result}"
106+
if [[ ${result} -eq 1 ]]; then
107+
TEST_FAILURE=1
108+
continue
109+
else
110+
# Return to success
111+
TEST_FAILURE=0
112+
break
113+
fi
101114
fi
115+
break
102116
done
103117
# End of retry part. This part can be removed anytime.
104118
}

0 commit comments

Comments
 (0)