|
7 | 7 | # runs performance tests for an performance name
|
8 | 8 |
|
9 | 9 | connector="$1"
|
| 10 | +separator="|" |
10 | 11 | all_performance_tests=$(./gradlew performanceTest --dry-run | grep 'performanceTest SKIPPED' | cut -d: -f 4)
|
11 | 12 | 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 |
29 | 33 | fi
|
30 |
| -if [[ "$connector" == "all" ]] ; then |
| 34 | +if [[ "$con" == "all" ]] ; then |
31 | 35 | echo "Running: ./gradlew --no-daemon --scan performanceTest"
|
32 | 36 | ./gradlew --no-daemon --scan performanceTest
|
33 | 37 | else
|
34 |
| - if [[ "$connector" == *"base-normalization"* ]]; then |
| 38 | + if [[ "$con" == *"base-normalization"* ]]; then |
35 | 39 | selected_performance_test="base-normalization"
|
36 | 40 | performanceTestCommand="$(_to_gradle_path "airbyte-integrations/bases/base-normalization" performanceTest)"
|
37 | 41 | export SUB_BUILD="CONNECTORS_BASE"
|
38 | 42 | # avoid schema conflicts when multiple tests for normalization are run concurrently
|
39 | 43 | export RANDOM_TEST_SCHEMA="true"
|
40 | 44 | ./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) |
43 | 47 | 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)" |
45 | 49 | 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) |
48 | 52 | 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)" |
50 | 54 | 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" |
53 | 57 | fi
|
54 | 58 | if [ -n "$selected_performance_test" ] ; then
|
55 | 59 | echo "Running: ./gradlew --no-daemon --scan $performanceTestCommand"
|
56 | 60 | ./gradlew --no-daemon --scan "$performanceTestCommand"
|
57 | 61 | else
|
58 |
| - echo "Connector '$connector' not found..." |
| 62 | + echo "Connector '$con' not found..." |
59 | 63 | return 1
|
60 | 64 | fi
|
61 | 65 | fi
|
|
0 commit comments