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 3db471c2bf0 HDDS-17666. Install bats libraries in .dev-tools/bats 
(#11911)
3db471c2bf0 is described below

commit 3db471c2bf085d746f8ee590c67332ea0f595877
Author: Doroszlai, Attila <[email protected]>
AuthorDate: Thu Nov 5 19:36:19 2026 +0100

    HDDS-17666. Install bats libraries in .dev-tools/bats (#11911)
---
 dev-support/ci/pr_title_check.bats              | 17 ++++-------------
 dev-support/ci/selective_ci_checks.bats         | 17 ++++-------------
 hadoop-ozone/dev-support/checks/bats.sh         | 22 ++++++++++++----------
 hadoop-ozone/dev-support/checks/install/bats.sh | 16 ++++++++++------
 4 files changed, 30 insertions(+), 42 deletions(-)

diff --git a/dev-support/ci/pr_title_check.bats 
b/dev-support/ci/pr_title_check.bats
index a3c90436602..8d89acf2433 100644
--- a/dev-support/ci/pr_title_check.bats
+++ b/dev-support/ci/pr_title_check.bats
@@ -18,21 +18,12 @@
 # This script confirms that pr_title_check.sh works correctly
 # against some valid and invalid examples.
 #
-# Prerequisites:
-#
-# 1. Install bats-core, see:
-#    https://bats-core.readthedocs.io/en/stable/installation.html
-#
-# 2. Clone libraries into dev-support/ci:
-#    cd dev-support/ci
-#    git clone https://github.com/bats-core/bats-assert
-#    git clone https://github.com/bats-core/bats-support
-#
 # Usage:
-#    bats dev-support/ci/pr_title_check.bats
+#     hadoop-ozone/dev-support/checks/bats.sh 
dev-support/ci/pr_title_check.bats
 
-load bats-support/load.bash
-load bats-assert/load.bash
+: ${TOOLS_DIR:="${BATS_ROOT}/../.."}
+load ${TOOLS_DIR}/bats/bats-support/load.bash
+load ${TOOLS_DIR}/bats/bats-assert/load.bash
 
 @test "check legal PR title examples" {
   # 1 digit Jira
diff --git a/dev-support/ci/selective_ci_checks.bats 
b/dev-support/ci/selective_ci_checks.bats
index 7817b38e843..c6aacd6eb92 100644
--- a/dev-support/ci/selective_ci_checks.bats
+++ b/dev-support/ci/selective_ci_checks.bats
@@ -17,21 +17,12 @@
 # This script confirms that selective_ci_checks.sh works correctly
 # against some known commits.
 #
-# Prerequisites:
-#
-# 1. Install bats-core, see:
-#    https://bats-core.readthedocs.io/en/stable/installation.html
-#
-# 2. Clone libraries into dev-support/ci:
-#    cd dev-support/ci
-#    git clone https://github.com/bats-core/bats-assert
-#    git clone https://github.com/bats-core/bats-support
-#
 # Usage:
-#    bats dev-support/ci/selective_ci_checks.bats
+#     hadoop-ozone/dev-support/checks/bats.sh 
dev-support/ci/selective_ci_checks.bats
 
-load bats-support/load.bash
-load bats-assert/load.bash
+: ${TOOLS_DIR:="${BATS_ROOT}/../.."}
+load ${TOOLS_DIR}/bats/bats-support/load.bash
+load ${TOOLS_DIR}/bats/bats-assert/load.bash
 
 @test "checkstyle and bats" {
   run dev-support/ci/selective_ci_checks.sh 11b098430
diff --git a/hadoop-ozone/dev-support/checks/bats.sh 
b/hadoop-ozone/dev-support/checks/bats.sh
index 839b4dd11e6..6142be38bb9 100755
--- a/hadoop-ozone/dev-support/checks/bats.sh
+++ b/hadoop-ozone/dev-support/checks/bats.sh
@@ -30,16 +30,18 @@ source "${DIR}/install/bats.sh"
 
 rm -f "${REPORT_DIR}/output.log"
 
-find * \( \
-    -path '*/src/test/shell/*' -name '*.bats' \
-    -or -path dev-support/ci/errorprone.bats \
-    -or -path dev-support/ci/selective_ci_checks.bats \
-    -or -path dev-support/ci/pr_title_check.bats \
-    -or -path dev-support/ci/find_test_class_project.bats \
-    -or -path dev-support/ci/junit_summary.bats \
-    \) -print0 \
-  | xargs -0 -n1 bats --formatter tap \
-  | tee -a "${REPORT_DIR}/output.log"
+# accept specific tests as argument
+if [[ "${CI:-}" != "true" ]] && [[ "$#" -ge 1 ]]; then
+  echo "$@" \
+    | xargs -n1 bats --formatter tap
+# or run all tests
+else
+  find * \
+      \( -path '*/src/test/shell/*.bats' -or -path 'dev-support/ci/*.bats' \) \
+      -not -path '*/bats-core/*' -not -path '*/bats-support/*' -not -path 
'*/bats-assert/*' \
+      -print0 \
+    | xargs -0 -n1 bats --formatter tap
+fi | tee -a "${REPORT_DIR}/output.log"
 rc=$?
 
 grep '^\(not ok\|#\)' "${REPORT_DIR}/output.log" > "${REPORT_FILE}"
diff --git a/hadoop-ozone/dev-support/checks/install/bats.sh 
b/hadoop-ozone/dev-support/checks/install/bats.sh
index b8d3aa7a27a..9a5bb1e6f26 100644
--- a/hadoop-ozone/dev-support/checks/install/bats.sh
+++ b/hadoop-ozone/dev-support/checks/install/bats.sh
@@ -14,16 +14,20 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# This script installs bats.
+# This script installs bats with bats-support and bats-assert libraries.
 # Requires _install_tool from _lib.sh.  Use `source` for both scripts, because 
it modifies $PATH.
 
-: ${BATS_VERSION:="1.2.1"}
+: ${BATS_VERSION:="1.14.0"}
+: ${BATS_SUPPORT_VERSION:="0.3.0"}
+: ${BATS_ASSERT_VERSION:="2.2.4"}
 
 _install_bats() {
-  curl -LSs 
"https://github.com/bats-core/bats-core/archive/v${BATS_VERSION}.tar.gz"; | tar 
-xz -f -
+  curl -LSs 
"https://github.com/bats-core/bats-core/archive/v${BATS_VERSION}.tar.gz"; | tar 
-xz -f - \
+    && curl -LSs 
"https://github.com/bats-core/bats-support/archive/v${BATS_SUPPORT_VERSION}.tar.gz";
 | tar -xz -f - \
+    && curl -LSs 
"https://github.com/bats-core/bats-assert/archive/v${BATS_ASSERT_VERSION}.tar.gz";
 | tar -xz -f - \
+    && rm -f bats-assert bats-support \
+    && ln -s bats-support-${BATS_SUPPORT_VERSION} bats-support \
+    && ln -s bats-assert-${BATS_ASSERT_VERSION} bats-assert
 }
 
 _install_tool bats "bats-core-${BATS_VERSION}/bin"
-
-git clone https://github.com/bats-core/bats-assert dev-support/ci/bats-assert
-git clone https://github.com/bats-core/bats-support dev-support/ci/bats-support


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to