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 ad6260489db HDDS-17840. Create CI check for Python unit tests (#12090)
ad6260489db is described below
commit ad6260489db5765ecfa4e36e80fbc59b6c4a5d0a
Author: kjs1095 <[email protected]>
AuthorDate: Fri Nov 20 00:35:34 2026 +0800
HDDS-17840. Create CI check for Python unit tests (#12090)
Co-authored-by: Claude Fable 5.1 <[email protected]>
---
.github/workflows/ci.yml | 4 +--
dev-support/ci/junit_summary.bats | 22 ---------------
dev-support/ci/selective_ci_checks.bats | 19 ++++++++++---
dev-support/ci/selective_ci_checks.sh | 16 +++++++++++
.../dev-support/checks/pyunit.sh | 31 +++++++++++++++++-----
5 files changed, 58 insertions(+), 34 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index dd1d57c988c..304718b9097 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -208,9 +208,9 @@ jobs:
uses: $/.github/workflows/check.yml
with:
checkout-fetch-depth: ${{ matrix.check != 'bats' && 1 || 0 }}
- java-version: ${{ !contains('author,bats', matrix.check) &&
needs.build-info.outputs.java-version || '' }}
+ java-version: ${{ !contains('author,bats,pyunit', matrix.check) &&
needs.build-info.outputs.java-version || '' }}
ratis-args: ${{ inputs.ratis_args }}
- runner: ${{ contains('author,bats', matrix.check) && 'ubuntu-slim' ||
'ubuntu-24.04' }}
+ runner: ${{ contains('author,bats,pyunit', matrix.check) &&
'ubuntu-slim' || 'ubuntu-24.04' }}
script: ${{ matrix.check }}
sha: ${{ needs.build-info.outputs.sha }}
timeout-minutes: 30
diff --git a/dev-support/ci/junit_summary.bats
b/dev-support/ci/junit_summary.bats
deleted file mode 100644
index 4f6003c6013..00000000000
--- a/dev-support/ci/junit_summary.bats
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/usr/bin/env bash
-
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-@test "junit_summary.py unit tests" {
- cd "${BATS_TEST_DIRNAME}"
- run python3 -m unittest test_junit_summary
- [ "$status" -eq 0 ]
-}
diff --git a/dev-support/ci/selective_ci_checks.bats
b/dev-support/ci/selective_ci_checks.bats
index c6aacd6eb92..073696f979a 100644
--- a/dev-support/ci/selective_ci_checks.bats
+++ b/dev-support/ci/selective_ci_checks.bats
@@ -325,7 +325,7 @@ load ${TOOLS_DIR}/bats/bats-assert/load.bash
@test "CI lib change" {
run dev-support/ci/selective_ci_checks.sh ceb79acaa
- assert_output -p
'basic-checks=["author","bats","checkstyle","errorprone","findbugs","pmd","rat"]'
+ assert_output -p
'basic-checks=["author","bats","checkstyle","errorprone","findbugs","pmd","pyunit","rat"]'
assert_output -p needs-build=true
assert_output -p needs-compile=true
assert_output -p needs-compose-tests=true
@@ -336,7 +336,7 @@ load ${TOOLS_DIR}/bats/bats-assert/load.bash
@test "CI workflow change" {
run dev-support/ci/selective_ci_checks.sh 90a8d7c01
- assert_output -p
'basic-checks=["author","bats","checkstyle","errorprone","findbugs","pmd","rat"]'
+ assert_output -p
'basic-checks=["author","bats","checkstyle","errorprone","findbugs","pmd","pyunit","rat"]'
assert_output -p needs-build=true
assert_output -p needs-compile=true
assert_output -p needs-compose-tests=true
@@ -359,7 +359,7 @@ load ${TOOLS_DIR}/bats/bats-assert/load.bash
@test "CI workflow change (check.yml)" {
run dev-support/ci/selective_ci_checks.sh
1468af02067ec75b255f605816c32f8bf4dfaabf
- assert_output -p
'basic-checks=["author","bats","checkstyle","errorprone","findbugs","pmd","rat"]'
+ assert_output -p
'basic-checks=["author","bats","checkstyle","errorprone","findbugs","pmd","pyunit","rat"]'
assert_output -p needs-build=true
assert_output -p needs-compile=true
assert_output -p needs-compose-tests=true
@@ -370,7 +370,7 @@ load ${TOOLS_DIR}/bats/bats-assert/load.bash
@test "CI workflow change (ci.yaml)" {
run dev-support/ci/selective_ci_checks.sh 90fd5f2adc
- assert_output -p
'basic-checks=["author","bats","checkstyle","errorprone","findbugs","pmd","rat"]'
+ assert_output -p
'basic-checks=["author","bats","checkstyle","errorprone","findbugs","pmd","pyunit","rat"]'
assert_output -p needs-build=true
assert_output -p needs-compile=true
assert_output -p needs-compose-tests=true
@@ -476,3 +476,14 @@ load ${TOOLS_DIR}/bats/bats-assert/load.bash
assert_output -p needs-integration-tests=true
assert_output -p needs-kubernetes-tests=false
}
+
+@test "python helper change" {
+ run dev-support/ci/selective_ci_checks.sh c917a6e60d
+
+ assert_output -p 'basic-checks=["rat","pyunit"]'
+ assert_output -p needs-build=true
+ assert_output -p needs-compile=false
+ assert_output -p needs-compose-tests=false
+ assert_output -p needs-integration-tests=false
+ assert_output -p needs-kubernetes-tests=false
+}
diff --git a/dev-support/ci/selective_ci_checks.sh
b/dev-support/ci/selective_ci_checks.sh
index ad9f63653f5..0bc8a233549 100755
--- a/dev-support/ci/selective_ci_checks.sh
+++ b/dev-support/ci/selective_ci_checks.sh
@@ -497,6 +497,21 @@ function check_needs_pmd() {
start_end::group_end
}
+function check_needs_pyunit() {
+ start_end::group_start "Check if pyunit is needed"
+ local pattern_array=(
+ "^dev-support/ci/.*\.py$"
+ "^hadoop-ozone/dev-support/checks/pyunit.sh"
+ )
+ filter_changed_files
+
+ if [[ ${match_count} != "0" ]]; then
+ add_basic_check pyunit
+ fi
+
+ start_end::group_end
+}
+
# Counts other files which do not need to trigger any functional test
# (i.e. no compose/integration/kubernetes)
function get_count_misc_files() {
@@ -640,5 +655,6 @@ check_needs_checkstyle
check_needs_errorprone
check_needs_findbugs
check_needs_pmd
+check_needs_pyunit
calculate_test_types_to_run
set_outputs
diff --git a/dev-support/ci/coverage_summary.bats
b/hadoop-ozone/dev-support/checks/pyunit.sh
old mode 100644
new mode 100755
similarity index 54%
rename from dev-support/ci/coverage_summary.bats
rename to hadoop-ozone/dev-support/checks/pyunit.sh
index 61e0c8b239c..3230b6a7813
--- a/dev-support/ci/coverage_summary.bats
+++ b/hadoop-ozone/dev-support/checks/pyunit.sh
@@ -1,5 +1,4 @@
#!/usr/bin/env bash
-
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
@@ -15,8 +14,28 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-@test "coverage_summary.py unit tests" {
- cd "${BATS_TEST_DIRNAME}"
- run python3 -m unittest test_coverage_summary
- [ "$status" -eq 0 ]
-}
+#checks:basic
+
+set -u -o pipefail
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
+# from <ozone-root>/hadoop-ozone/dev-support/checks to <ozone-root>
+cd "${DIR}/../../.." || exit 1
+BASE_DIR="$(pwd -P)"
+
+CHECK=pyunit
+
+REPORT_DIR=${OUTPUT_DIR:-"${BASE_DIR}/target/${CHECK}"}
+mkdir -p "${REPORT_DIR}"
+
+REPORT_FILE="${REPORT_DIR}/summary.txt"
+
+python3 -m unittest discover -v -s dev-support/ci -p 'test_*.py' 2>&1 \
+ | tee "${REPORT_DIR}/output.log"
+rc=$?
+
+grep '^\(FAIL\|ERROR\): ' "${REPORT_DIR}/output.log" > "${REPORT_FILE}"
+grep -c '^\(FAIL\|ERROR\): ' "${REPORT_FILE}" > "${REPORT_DIR}/failures"
+
+ERROR_PATTERN=""
+source "${DIR}/_post_process.sh"
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]