Skip to content

Commit c07e7d5

Browse files
authoredDec 13, 2021
🎉 Updated ci performance test sh script (#8739)
* updated ci performance test sh script * updated ci performance test sh script * set all params to one arg
1 parent 02e61ac commit c07e7d5

File tree

1 file changed

+32
-28
lines changed

1 file changed

+32
-28
lines changed
 

‎tools/bin/ci_performance_test.sh

+32-28
Original file line numberDiff line numberDiff line change
@@ -7,55 +7,59 @@ set -e
77
# runs performance tests for an performance name
88

99
connector="$1"
10+
separator="|"
1011
all_performance_tests=$(./gradlew performanceTest --dry-run | grep 'performanceTest SKIPPED' | cut -d: -f 4)
1112
run() {
12-
firstarg=""
13-
secondarg=""
14-
if [[ "$2" ]]; then
15-
if [[ "$2" == *"cpulimit"* ]]; then
16-
firstarg="-DcpuLimit=$(echo $2 | cut -d = -f 2)"
17-
fi
18-
if [[ "$2" == *"memorylimit"* ]]; then
19-
firstarg="-DmemoryLimit=$(echo $2 | cut -d = -f 2)"
20-
fi
21-
fi
22-
if [[ "$3" ]]; then
23-
if [[ "$3" == *"cpulimit"* ]]; then
24-
secondarg="-DcpuLimit=$(echo $3 | cut -d = -f 2)"
25-
fi
26-
if [[ "$3" == *"memorylimit"* ]]; then
27-
secondarg="-DmemoryLimit=$(echo $3 | cut -d = -f 2)"
28-
fi
13+
con=""
14+
cpulimit=""
15+
memorylimit=""
16+
tmp=${connector//"$separator"/$'\2'}
17+
IFS=$'\2' read -a arr <<< "$tmp"
18+
if [[ ${#array[@]} == 1 ]]; then
19+
con="$connector"
20+
else
21+
for substr in "${arr[@]}" ; do
22+
echo "<$substr>"
23+
if [[ "$substr" == *"cpulimit"* ]]; then
24+
cpulimit="-DcpuLimit=$(echo $substr | cut -d = -f 2)"
25+
fi
26+
if [[ "$substr" == *"memorylimit"* ]]; then
27+
memorylimit="-DmemoryLimit=$(echo $substr | cut -d = -f 2)"
28+
fi
29+
if [[ "$substr" == "all" || "$substr" == *"base-normalization"* || "$substr" == *"bases"* || "$substr" == *"connectors"* ]]; then
30+
con="$substr"
31+
fi
32+
done
2933
fi
30-
if [[ "$connector" == "all" ]] ; then
34+
if [[ "$con" == "all" ]] ; then
3135
echo "Running: ./gradlew --no-daemon --scan performanceTest"
3236
./gradlew --no-daemon --scan performanceTest
3337
else
34-
if [[ "$connector" == *"base-normalization"* ]]; then
38+
if [[ "$con" == *"base-normalization"* ]]; then
3539
selected_performance_test="base-normalization"
3640
performanceTestCommand="$(_to_gradle_path "airbyte-integrations/bases/base-normalization" performanceTest)"
3741
export SUB_BUILD="CONNECTORS_BASE"
3842
# avoid schema conflicts when multiple tests for normalization are run concurrently
3943
export RANDOM_TEST_SCHEMA="true"
4044
./gradlew --no-daemon --scan airbyteDocker
41-
elif [[ "$connector" == *"bases"* ]]; then
42-
connector_name=$(echo $connector | cut -d / -f 2)
45+
elif [[ "$con" == *"bases"* ]]; then
46+
connector_name=$(echo $con | cut -d / -f 2)
4347
selected_performance_test=$(echo "$all_performance_tests" | grep "^$connector_name$" || echo "")
44-
performanceTestCommand="$(_to_gradle_path "airbyte-integrations/$connector" performanceTest)"
48+
performanceTestCommand="$(_to_gradle_path "airbyte-integrations/$con" performanceTest)"
4549
export SUB_BUILD="CONNECTORS_BASE"
46-
elif [[ "$connector" == *"connectors"* ]]; then
47-
connector_name=$(echo $connector | cut -d / -f 2)
50+
elif [[ "$con" == *"connectors"* ]]; then
51+
connector_name=$(echo $con | cut -d / -f 2)
4852
selected_performance_test=$(echo "$all_performance_tests" | grep "^$connector_name$" || echo "")
49-
performanceTestCommand="$(_to_gradle_path "airbyte-integrations/$connector $firstarg $secondarg" performanceTest)"
53+
performanceTestCommand="$(_to_gradle_path "airbyte-integrations/$con $firstarg $secondarg" performanceTest)"
5054
else
51-
selected_performance_test=$(echo "$all_performance_tests" | grep "^$connector$" || echo "")
52-
performanceTestCommand=":airbyte-integrations:connectors:$connector:performanceTest $firstarg $secondarg"
55+
selected_performance_test=$(echo "$all_performance_tests" | grep "^$con$" || echo "")
56+
performanceTestCommand=":airbyte-integrations:connectors:$con:performanceTest $firstarg $secondarg"
5357
fi
5458
if [ -n "$selected_performance_test" ] ; then
5559
echo "Running: ./gradlew --no-daemon --scan $performanceTestCommand"
5660
./gradlew --no-daemon --scan "$performanceTestCommand"
5761
else
58-
echo "Connector '$connector' not found..."
62+
echo "Connector '$con' not found..."
5963
return 1
6064
fi
6165
fi

0 commit comments

Comments
 (0)
Please sign in to comment.