You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hop.apache.org by ha...@apache.org on 2020/12/08 14:58:09 UTC
[incubator-hop] branch master updated: HOP-2122: change logic to
allow multiple tests per project (#449)
This is an automated email from the ASF dual-hosted git repository.
hansva pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hop.git
The following commit(s) were added to refs/heads/master by this push:
new c4a04cf HOP-2122: change logic to allow multiple tests per project (#449)
c4a04cf is described below
commit c4a04cf9fcb1bcda6e99a4662965cb2cbc78f804
Author: Hans Van Akelyen <ha...@gmail.com>
AuthorDate: Tue Dec 8 15:57:18 2020 +0100
HOP-2122: change logic to allow multiple tests per project (#449)
---
.../{main.hwf => main_0001_test_shell_step.hwf} | 0
.../{main.hwf => main_0001_test_valuelist.hwf} | 0
...in.hwf => main_0001_pipeline_executor_test.hwf} | 0
.../{main.hwf => main_0001_copy_to_params.hwf} | 0
...{main.hwf => main_0001_empty_variable_test.hwf} | 0
integration-tests/scripts/run-tests.sh | 185 +++++++++++----------
6 files changed, 101 insertions(+), 84 deletions(-)
diff --git a/integration-tests/HOP-2135_test_shell_step/main.hwf b/integration-tests/HOP-2135_test_shell_step/main_0001_test_shell_step.hwf
similarity index 100%
rename from integration-tests/HOP-2135_test_shell_step/main.hwf
rename to integration-tests/HOP-2135_test_shell_step/main_0001_test_shell_step.hwf
diff --git a/integration-tests/HOP-2173_test_SingletonUtil_getValuesList/main.hwf b/integration-tests/HOP-2173_test_SingletonUtil_getValuesList/main_0001_test_valuelist.hwf
similarity index 100%
rename from integration-tests/HOP-2173_test_SingletonUtil_getValuesList/main.hwf
rename to integration-tests/HOP-2173_test_SingletonUtil_getValuesList/main_0001_test_valuelist.hwf
diff --git a/integration-tests/HOP-2199_test_pipeline_executor/main.hwf b/integration-tests/HOP-2199_test_pipeline_executor/main_0001_pipeline_executor_test.hwf
similarity index 100%
rename from integration-tests/HOP-2199_test_pipeline_executor/main.hwf
rename to integration-tests/HOP-2199_test_pipeline_executor/main_0001_pipeline_executor_test.hwf
diff --git a/integration-tests/HOP-2202_test_copy_result_to_params/main.hwf b/integration-tests/HOP-2202_test_copy_result_to_params/main_0001_copy_to_params.hwf
similarity index 100%
rename from integration-tests/HOP-2202_test_copy_result_to_params/main.hwf
rename to integration-tests/HOP-2202_test_copy_result_to_params/main_0001_copy_to_params.hwf
diff --git a/integration-tests/HOP-2214_test_empty_variables/main.hwf b/integration-tests/HOP-2214_test_empty_variables/main_0001_empty_variable_test.hwf
similarity index 100%
rename from integration-tests/HOP-2214_test_empty_variables/main.hwf
rename to integration-tests/HOP-2214_test_empty_variables/main_0001_empty_variable_test.hwf
diff --git a/integration-tests/scripts/run-tests.sh b/integration-tests/scripts/run-tests.sh
index 898d818..d76ea45 100755
--- a/integration-tests/scripts/run-tests.sh
+++ b/integration-tests/scripts/run-tests.sh
@@ -6,108 +6,125 @@ if [ -z "${HOP_LOCATION}" ]; then
HOP_LOCATION=/opt/hop
fi
-#set start variables
-start_time=$SECONDS
-test_counter=0
-errors_counter=0
-skipped_counter=0
-failures_counter=0
+#set global variables
spacer="==========================================="
#cleanup Temp
-echo "" > /tmp/testcases
+rm -f /tmp/testcases
+rm -rf $current_dir/../surefire-reports
+mkdir -p $current_dir/../surefire-reports/
#Loop over project folders
for d in $current_dir/../*/ ; do
- if [[ "$d" != *"scripts/" ]]; then
+ if [[ "$d" != *"scripts/" ]] && [[ "$d" != *"surefire-reports/" ]]; then
+
+ #set test variables
+ start_time=$SECONDS
+ test_counter=0
+ errors_counter=0
+ skipped_counter=0
+ failures_counter=0
- test_name=$(basename $d)
+ project_name=$(basename $d)
echo $spacer
- echo "Starting Test: $test_name"
+ echo "Starting Tests in project: $project_name"
echo $spacer
#Increment timer and set test start time
test_counter=$((test_counter+1))
#Delete project first
- $HOP_LOCATION/hop-conf.sh -pd -p $test_name
+ $HOP_LOCATION/hop-conf.sh -pd -p $project_name
#Create New Project
- $HOP_LOCATION/hop-conf.sh -pc -p $test_name -ph "$(readlink -f $d)"
-
- #Find main hwf/ TODO: add hpl support when result is returned correctly
- HOP_FILE="$(readlink -f $d/main.hwf)"
-
- #Start time test
- start_time_test=$SECONDS
-
- #Run Test
- $HOP_LOCATION/hop-run.sh -j $test_name -r "local" -f $HOP_FILE > >(tee /tmp/test_output) 2> >(tee /tmp/test_output_err >&1)
-
- #Capture exit code
- exit_code=${PIPESTATUS[0]}
-
- #Test time duration
- test_duration=$(( SECONDS - start_time_test ))
-
- if (( $exit_code >= 1 )) ;
- then
- errors_counter=$((errors_counter+1))
- failures_counter=$((failures_counter+1))
- #Create surefire xml failure
- echo "<testcase name=\"$test_name\" time=\"$test_duration\">" >> /tmp/testcases
- echo "<failure type=\"$test_name\"></failure>" >> /tmp/testcases
- echo "<system-out>" >> /tmp/testcases
- echo "<![CDATA[" >> /tmp/testcases
- cat /tmp/test_output >> /tmp/testcases
- echo "]]>" >> /tmp/testcases
- echo "</system-out>" >> /tmp/testcases
- echo "<system-err>" >> /tmp/testcases
- echo "<![CDATA[" >> /tmp/testcases
- cat /tmp/test_output_err >> /tmp/testcases
- echo "]]>" >> /tmp/testcases
- echo "</system-err>" >> /tmp/testcases
- echo "</testcase>" >> /tmp/testcases
-
- else
- #Create surefire xml success
- echo "<testcase name=\"$test_name\" time=\"$test_duration\">" >> /tmp/testcases
- echo "<system-out>" >> /tmp/testcases
- echo "<![CDATA[" >> /tmp/testcases
- cat /tmp/test_output >> /tmp/testcases
- echo "]]>" >> /tmp/testcases
- echo "</system-out>" >> /tmp/testcases
- echo "</testcase>" >> /tmp/testcases
- fi
-
- #Print results to console
+ $HOP_LOCATION/hop-conf.sh -pc -p $project_name -ph "$(readlink -f $d)"
+
+ #Find main hwf files TODO: add hpl support when result is returned correctly
+ for f in $d/main_*.hwf ; do
+
+ #cleanup temp files
+ rm -f /tmp/test_output
+ rm -f /tmp/test_output_err
+
+ #set file and test name
+ hop_file="$(readlink -f $f)"
+ test_name=$(basename $f)
+ test_name=${test_name//'main_'/}
+ test_name=${test_name//'.hwf'/}
+
+ #Starting Test
+ echo $spacer
+ echo "Starting Test: $test_name"
+ echo $spacer
+
+ #Start time test
+ start_time_test=$SECONDS
+
+ #Run Test
+ $HOP_LOCATION/hop-run.sh -j $project_name -r "local" -f $hop_file > >(tee /tmp/test_output) 2> >(tee /tmp/test_output_err >&1)
+
+ #Capture exit code
+ exit_code=${PIPESTATUS[0]}
+
+ #Test time duration
+ test_duration=$(( SECONDS - start_time_test ))
+
+ if (( $exit_code >= 1 )) ;
+ then
+ errors_counter=$((errors_counter+1))
+ failures_counter=$((failures_counter+1))
+ #Create surefire xml failure
+ echo "<testcase name=\"$test_name\" time=\"$test_duration\">" >> /tmp/testcases
+ echo "<failure type=\"$test_name\"></failure>" >> /tmp/testcases
+ echo "<system-out>" >> /tmp/testcases
+ echo "<![CDATA[" >> /tmp/testcases
+ cat /tmp/test_output >> /tmp/testcases
+ echo "]]>" >> /tmp/testcases
+ echo "</system-out>" >> /tmp/testcases
+ echo "<system-err>" >> /tmp/testcases
+ echo "<![CDATA[" >> /tmp/testcases
+ cat /tmp/test_output_err >> /tmp/testcases
+ echo "]]>" >> /tmp/testcases
+ echo "</system-err>" >> /tmp/testcases
+ echo "</testcase>" >> /tmp/testcases
+
+ else
+ #Create surefire xml success
+ echo "<testcase name=\"$test_name\" time=\"$test_duration\">" >> /tmp/testcases
+ echo "<system-out>" >> /tmp/testcases
+ echo "<![CDATA[" >> /tmp/testcases
+ cat /tmp/test_output >> /tmp/testcases
+ echo "]]>" >> /tmp/testcases
+ echo "</system-out>" >> /tmp/testcases
+ echo "</testcase>" >> /tmp/testcases
+ fi
+
+ #Print results to console
+ echo $spacer
+ echo "Test Result"
+ echo $spacer
+ echo "Test duration: $test_duration"
+ echo "Test Exit Code: $exit_code"
+
+ done
+
+ total_duration=$(( SECONDS - start_time ))
+
+ #Print End results
echo $spacer
- echo "Test Result"
+ echo "Final Report"
echo $spacer
- echo "Test duration: $test_duration"
- echo "Test Exit Code: $exit_code"
+ echo "Number of Tests: $test_counter"
+ echo "Total errors: $errors_counter"
+ echo "Total faliures: $failures_counter"
+ echo "Total duration: $total_duration"
+
+ #create final report
+ echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > $current_dir/../surefire-reports/surefile_$project_name.xml
+ echo "<testsuite xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report-3.0.xsd\" version=\"3.0\" name=\"$project_name\" time=\"$total_duration\" tests=\"$test_counter\" errors=\"$errors_counter\" skipped=\"$skipped_counter\" failures=\"$failures_counter\">" >> $current_dir/../surefire-reports/surefile_$project_name.xml
+ cat /tmp/testcases >> $current_dir/../surefire-reports/surefile_$project_name.xml
+ echo "</testsuite>" >> $current_dir/../surefire-reports/surefile_$project_name.xml
fi
-done
-
-total_duration=$(( SECONDS - start_time ))
-
-#Print End results
-echo $spacer
-echo "Final Report"
-echo $spacer
-echo "Number of Tests: $test_counter"
-echo "Total errors: $errors_counter"
-echo "Total faliures: $failures_counter"
-echo "Total duration: $total_duration"
-
-#create final report
-echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" >> /tmp/surefire_report.xml
-echo "<testsuite xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report-3.0.xsd\" version=\"3.0\" name=\"Hop Integration Tests\" time=\"$total_duration\" tests=\"$test_counter\" errors=\"$errors_counter\" skipped=\"$skipped_counter\" failures=\"$failures_counter\">" >> /tmp/surefire_report.xml
-cat /tmp/testcases >> /tmp/surefire_report.xml
-echo "</testsuite>" >> /tmp/surefire_report.xml
-
-#Copy final report back
-mkdir -p $current_dir/../surefire-reports/
-cp /tmp/surefire_report.xml $current_dir/../surefire-reports/report.xml
+done
\ No newline at end of file