You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by el...@apache.org on 2020/07/29 10:48:05 UTC

[hadoop-ozone] branch master updated: HDDS-4031. Run shell tests in CI (#1261)

This is an automated email from the ASF dual-hosted git repository.

elek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hadoop-ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 829b860  HDDS-4031. Run shell tests in CI (#1261)
829b860 is described below

commit 829b8602b1667be2374a9376b416ba8f2919245c
Author: Doroszlai, Attila <64...@users.noreply.github.com>
AuthorDate: Wed Jul 29 12:47:58 2020 +0200

    HDDS-4031. Run shell tests in CI (#1261)
---
 .github/workflows/post-commit.yml             | 20 +++++++++++++++
 hadoop-ozone/dev-support/checks/bats.sh       | 35 +++++++++++++++++++++++++++
 hadoop-ozone/dist/src/test/shell/gc_opts.bats |  6 ++---
 3 files changed, 57 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/post-commit.yml b/.github/workflows/post-commit.yml
index d0b5433..992715f 100644
--- a/.github/workflows/post-commit.yml
+++ b/.github/workflows/post-commit.yml
@@ -35,6 +35,26 @@ jobs:
       - uses: ./.github/buildenv
         with:
           args: ./hadoop-ozone/dev-support/checks/build.sh
+  bats:
+    runs-on: ubuntu-18.04
+    steps:
+      - uses: actions/checkout@v2
+      - name: install bats
+        run: |
+          cd /tmp
+          curl -LSs https://github.com/bats-core/bats-core/archive/v1.2.1.tar.gz | tar xzf -
+          cd bats-core-1.2.1
+          sudo ./install.sh /usr/local
+      - name: run tests
+        run: ./hadoop-ozone/dev-support/checks/${{ github.job }}.sh
+      - name: Summary of failures
+        run: cat target/${{ github.job }}/summary.txt
+        if: always()
+      - uses: actions/upload-artifact@master
+        if: always()
+        with:
+          name: ${{ github.job }}
+          path: target/${{ github.job }}
   rat:
     name: rat
     runs-on: ubuntu-18.04
diff --git a/hadoop-ozone/dev-support/checks/bats.sh b/hadoop-ozone/dev-support/checks/bats.sh
new file mode 100755
index 0000000..2e1bbad
--- /dev/null
+++ b/hadoop-ozone/dev-support/checks/bats.sh
@@ -0,0 +1,35 @@
+#!/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.
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
+cd "${DIR}/../../.." || exit 1
+
+REPORT_DIR=${OUTPUT_DIR:-"${DIR}/../../../target/bats"}
+mkdir -p "${REPORT_DIR}"
+REPORT_FILE="${REPORT_DIR}/summary.txt"
+
+rm -f "${REPORT_DIR}/output.log"
+
+find * -path '*/src/test/shell/*' -name '*.bats' -print0 \
+  | xargs -0 -n1 bats --formatter tap \
+  | tee -a "${REPORT_DIR}/output.log"
+
+grep '^\(not ok\|#\)' "${REPORT_DIR}/output.log" > "${REPORT_FILE}"
+
+grep -c '^not ok' "${REPORT_FILE}" > "${REPORT_DIR}/failures"
+
+if [[ -s "${REPORT_FILE}" ]]; then
+   exit 1
+fi
diff --git a/hadoop-ozone/dist/src/test/shell/gc_opts.bats b/hadoop-ozone/dist/src/test/shell/gc_opts.bats
index 1400a40..feb29af 100644
--- a/hadoop-ozone/dist/src/test/shell/gc_opts.bats
+++ b/hadoop-ozone/dist/src/test/shell/gc_opts.bats
@@ -14,14 +14,12 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-
-
 #
 # Can be executed with bats (https://github.com/bats-core/bats-core)
-# bats gc_opts.bats (FROM THE CURRENT DIRECTORY)
+# bats gc_opts.bats
 #
 
-source ../../shell/hdds/hadoop-functions.sh
+load ../../shell/hdds/hadoop-functions.sh
 @test "Setting Hadoop GC parameters: add GC params for server" {
   export HADOOP_SUBCMD_SUPPORTDAEMONIZATION=true
   export HADOOP_OPTS="Test"


---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-commits-help@hadoop.apache.org