This is an automated email from the ASF dual-hosted git repository.
adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new 917ce68 HDDS-6186. Selective checks: skip integration check for unit
test changes (#3061)
917ce68 is described below
commit 917ce68ed192a9b35e23bcb58202169f2fe9ba0e
Author: Doroszlai, Attila <[email protected]>
AuthorDate: Tue Feb 15 07:20:49 2022 +0100
HDDS-6186. Selective checks: skip integration check for unit test changes
(#3061)
Co-authored-by: George Jahad <[email protected]>
---
dev-support/ci/selective_ci_checks.bats | 48 ++++++++++++++++++++++++++--
dev-support/ci/selective_ci_checks.sh | 55 ++++++++++++++++++++++-----------
2 files changed, 83 insertions(+), 20 deletions(-)
diff --git a/dev-support/ci/selective_ci_checks.bats
b/dev-support/ci/selective_ci_checks.bats
index 8093123..e5788fe 100644
--- a/dev-support/ci/selective_ci_checks.bats
+++ b/dev-support/ci/selective_ci_checks.bats
@@ -88,7 +88,7 @@ load bats-assert/load.bash
assert_output -p needs-kubernetes-tests=true
}
-@test "integration and unit" {
+@test "integration and unit: java change" {
run dev-support/ci/selective_ci_checks.sh 9aebf6e25
assert_output -p
'basic-checks=["rat","author","checkstyle","findbugs","unit"]'
@@ -99,6 +99,39 @@ load bats-assert/load.bash
assert_output -p needs-kubernetes-tests=false
}
+@test "integration and unit: script change" {
+ run dev-support/ci/selective_ci_checks.sh c6850484f
+
+ assert_output -p 'basic-checks=["rat","bats","unit"]'
+ assert_output -p needs-build=false
+ assert_output -p needs-compose-tests=false
+ assert_output -p needs-dependency-check=false
+ assert_output -p needs-integration-tests=true
+ assert_output -p needs-kubernetes-tests=false
+}
+
+@test "unit only" {
+ run dev-support/ci/selective_ci_checks.sh 1dd1d0ba3
+
+ assert_output -p
'basic-checks=["rat","author","checkstyle","findbugs","unit"]'
+ assert_output -p needs-build=false
+ assert_output -p needs-compose-tests=false
+ assert_output -p needs-dependency-check=false
+ assert_output -p needs-integration-tests=false
+ assert_output -p needs-kubernetes-tests=false
+}
+
+@test "unit helper" {
+ run dev-support/ci/selective_ci_checks.sh 88383d1d5
+
+ assert_output -p
'basic-checks=["rat","author","checkstyle","findbugs","unit"]'
+ assert_output -p needs-build=false
+ assert_output -p needs-compose-tests=false
+ assert_output -p needs-dependency-check=false
+ assert_output -p needs-integration-tests=true
+ assert_output -p needs-kubernetes-tests=false
+}
+
@test "integration only" {
run dev-support/ci/selective_ci_checks.sh 61396ba9f
@@ -132,7 +165,18 @@ load bats-assert/load.bash
assert_output -p needs-kubernetes-tests=false
}
-@test "java-only change" {
+@test "main/java change" {
+ run dev-support/ci/selective_ci_checks.sh 86a771dfe
+
+ assert_output -p
'basic-checks=["rat","author","checkstyle","findbugs","unit"]'
+ assert_output -p needs-build=true
+ assert_output -p needs-compose-tests=true
+ assert_output -p needs-dependency-check=false
+ assert_output -p needs-integration-tests=true
+ assert_output -p needs-kubernetes-tests=true
+}
+
+@test "..../java change" {
run dev-support/ci/selective_ci_checks.sh 01c616536
assert_output -p
'basic-checks=["rat","author","checkstyle","findbugs","unit"]'
diff --git a/dev-support/ci/selective_ci_checks.sh
b/dev-support/ci/selective_ci_checks.sh
index 3989afe..fd9ab5b 100755
--- a/dev-support/ci/selective_ci_checks.sh
+++ b/dev-support/ci/selective_ci_checks.sh
@@ -242,18 +242,30 @@ function get_count_doc_files() {
start_end::group_end
}
-function get_count_junit_files() {
- start_end::group_start "Count junit test files"
+function get_count_integration_files() {
+ start_end::group_start "Count integration test files"
local pattern_array=(
"^hadoop-ozone/dev-support/checks/_mvn_unit_report.sh"
"^hadoop-ozone/dev-support/checks/integration.sh"
- "^hadoop-ozone/dev-support/checks/unit.sh"
+ "^hadoop-ozone/integration-test"
+ "^hadoop-ozone/fault-injection-test/mini-chaos-tests"
"src/test/java"
- "src/test/resources"
+ )
+ # Ozone's unit test naming convention: Test*.java
+ # The following makes this filter ignore all tests except those in
+ # integration-test and fault-injection-test.
+ # Directories starting with `i` under hadoop-ozone need to be listed
+ # explicitly, other subdirectories are captured by the second item.
+ local ignore_array=(
+ "^hadoop-hdds/.*/src/test/java/.*/Test.*.java"
+ "^hadoop-ozone/[a-eghj-z].*/src/test/java/.*/Test.*.java"
+ "^hadoop-ozone/insight/src/test/java/.*/Test.*.java"
+ "^hadoop-ozone/interface-client/src/test/java/.*/Test.*.java"
+ "^hadoop-ozone/interface-storage/src/test/java/.*/Test.*.java"
)
filter_changed_files true
- COUNT_JUNIT_CHANGED_FILES=${match_count}
- readonly COUNT_JUNIT_CHANGED_FILES
+ COUNT_INTEGRATION_CHANGED_FILES=${match_count}
+ readonly COUNT_INTEGRATION_CHANGED_FILES
start_end::group_end
}
@@ -308,7 +320,7 @@ function check_needs_author() {
filter_changed_files
if [[ ${match_count} != "0" ]]; then
- BASIC_CHECKS="${BASIC_CHECKS} author"
+ add_basic_check author
fi
start_end::group_end
@@ -324,7 +336,7 @@ function check_needs_bats() {
filter_changed_files
if [[ ${match_count} != "0" ]]; then
- BASIC_CHECKS="${BASIC_CHECKS} bats"
+ add_basic_check bats
fi
start_end::group_end
@@ -344,7 +356,7 @@ function check_needs_checkstyle() {
filter_changed_files
if [[ ${match_count} != "0" ]]; then
- BASIC_CHECKS="${BASIC_CHECKS} checkstyle"
+ add_basic_check checkstyle
fi
start_end::group_end
@@ -352,7 +364,7 @@ function check_needs_checkstyle() {
function check_needs_docs() {
if [[ ${COUNT_DOC_CHANGED_FILES} != "0" ]]; then
- BASIC_CHECKS="${BASIC_CHECKS} docs"
+ add_basic_check docs
fi
}
@@ -388,7 +400,7 @@ function check_needs_findbugs() {
filter_changed_files
if [[ ${match_count} != "0" ]]; then
- BASIC_CHECKS="${BASIC_CHECKS} findbugs"
+ add_basic_check findbugs
fi
start_end::group_end
@@ -399,19 +411,18 @@ function check_needs_unit_test() {
local pattern_array=(
"^hadoop-ozone/dev-support/checks/_mvn_unit_report.sh"
"^hadoop-ozone/dev-support/checks/unit.sh"
- "pom.xml"
- "src/..../java"
- "src/..../resources"
+ "src/test/java"
+ "src/test/resources"
)
local ignore_array=(
"^hadoop-ozone/dist"
"^hadoop-ozone/fault-injection-test/mini-chaos-tests"
"^hadoop-ozone/integration-test"
)
- filter_changed_files
+ filter_changed_files true
if [[ ${match_count} != "0" ]]; then
- BASIC_CHECKS="${BASIC_CHECKS} unit"
+ add_basic_check unit
fi
start_end::group_end
@@ -438,6 +449,13 @@ function get_count_misc_files() {
start_end::group_end
}
+function add_basic_check() {
+ local check="$1"
+ if [[ "$BASIC_CHECKS" != *${check}* ]]; then
+ BASIC_CHECKS="${BASIC_CHECKS} ${check}"
+ fi
+}
+
function calculate_test_types_to_run() {
start_end::group_start "Count core/other files"
verbosity::store_exit_on_error_status
@@ -457,13 +475,14 @@ function calculate_test_types_to_run() {
compose_tests_needed=true
integration_tests_needed=true
kubernetes_tests_needed=true
+ add_basic_check unit
else
echo "All ${COUNT_ALL_CHANGED_FILES} changed files are known to be
handled by specific checks."
echo
if [[ ${COUNT_COMPOSE_CHANGED_FILES} != "0" ]] || [[
${COUNT_ROBOT_CHANGED_FILES} != "0" ]]; then
compose_tests_needed="true"
fi
- if [[ ${COUNT_JUNIT_CHANGED_FILES} != "0" ]]; then
+ if [[ ${COUNT_INTEGRATION_CHANGED_FILES} != "0" ]]; then
integration_tests_needed="true"
fi
if [[ ${COUNT_KUBERNETES_CHANGED_FILES} != "0" ]] || [[
${COUNT_ROBOT_CHANGED_FILES} != "0" ]]; then
@@ -519,7 +538,7 @@ check_if_tests_are_needed_at_all
get_count_all_files
get_count_compose_files
get_count_doc_files
-get_count_junit_files
+get_count_integration_files
get_count_kubernetes_files
get_count_robot_files
get_count_misc_files
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]