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

potiuk pushed a commit to branch v1-10-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/v1-10-test by this push:
     new 0e5bff3  Revert "in_container bats pre-commit hook and updated 
bats-tests hook (#11179)"
0e5bff3 is described below

commit 0e5bff365fcd6e25ed4828ec929211999241dd09
Author: Jarek Potiuk <[email protected]>
AuthorDate: Sat Oct 3 23:59:31 2020 +0200

    Revert "in_container bats pre-commit hook and updated bats-tests hook 
(#11179)"
    
    This reverts commit 84c2379d6dcc28b86eda9854b9c70835bb2b1180.
---
 .dockerignore                                      |  1 -
 .pre-commit-config.yaml                            |  9 +----
 BREEZE.rst                                         |  6 ++--
 Dockerfile.ci                                      | 31 ----------------
 STATIC_CODE_CHECKS.rst                             |  8 -----
 breeze-complete                                    |  1 -
 .../pre_commit_in_container_bats_test.sh           | 30 ----------------
 scripts/ci/static_checks/bats_tests.sh             | 19 ++--------
 .../ci/static_checks/in_container_bats_tests.sh    | 41 ----------------------
 tests/bats/in_container/test_in_container.bats     | 31 ----------------
 tests/bats/test_empty_test.bats                    |  1 -
 11 files changed, 7 insertions(+), 171 deletions(-)

diff --git a/.dockerignore b/.dockerignore
index c914d56..7d29561 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -38,7 +38,6 @@
 # Add those folders to the context so that they are available in the CI 
container
 !scripts/in_container
 !scripts/docker
-!scripts/ci/dockerfiles/bats
 
 # Add tests and kubernetes_tests to context.
 !tests
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 1d278e5..cb5d15d 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -308,12 +308,6 @@ repos:
         pass_filenames: false
         require_serial: true
         additional_dependencies: ['pyyaml']
-      - id: bats-in-container-tests
-        name: Run in container bats tests
-        language: system
-        entry: "./scripts/ci/pre_commit/pre_commit_in_container_bats_test.sh"
-        files: ^tests/bats/in_container/.*.bats$|^scripts/in_container/.*sh
-        pass_filenames: false
       - id: mypy
         name: Run mypy
         language: system
@@ -331,8 +325,7 @@ repos:
         name: Run BATS bash tests for changed bash files
         language: system
         entry: "./scripts/ci/pre_commit/pre_commit_bat_tests.sh"
-        files: ^breeze$|^breeze-complete$|\.sh$|\.bash$|\.bats$
-        exclude: ^tests/bats/in_container/.*bats$|^scripts/in_container/.*sh$
+        files: ^breeze$|^breeze-complete$|\.sh$|\.bash$|.bats$
         pass_filenames: false
       - id: pre-commit-descriptions
         name: Check if pre-commits are described
diff --git a/BREEZE.rst b/BREEZE.rst
index 5b23c84..2c72977 100644
--- a/BREEZE.rst
+++ b/BREEZE.rst
@@ -1794,9 +1794,9 @@ This is the current syntax for  `./breeze <./breeze>`_:
         Run selected static checks for currently changed files. You should 
specify static check that
         you would like to run or 'all' to run all checks. One of:
 
-                 all airflow-config-yaml base-operator bats-tests 
bats-in-container-tests black build
-                 check-apache-license check-builtin-literals 
check-executables-have-shebangs
-                 check-hooks-apply check-integrations check-merge-conflict 
check-xml debug-statements
+                 all airflow-config-yaml base-operator bats-tests black build 
check-apache-license
+                 check-builtin-literals check-executables-have-shebangs 
check-hooks-apply
+                 check-integrations check-merge-conflict check-xml 
debug-statements
                  detect-private-key doctoc dont-use-safe-filter 
end-of-file-fixer fix-encoding-pragma
                  flake8 forbid-tabs helm-lint incorrect-use-of-LoggingMixin 
insert-license
                  language-matters lint-dockerfile lint-openapi 
mixed-line-ending mypy
diff --git a/Dockerfile.ci b/Dockerfile.ci
index 2bbc9ac..0469e5f 100644
--- a/Dockerfile.ci
+++ b/Dockerfile.ci
@@ -191,35 +191,6 @@ RUN mkdir -pv ${AIRFLOW_HOME} && \
 ARG PIP_DEPENDENCIES_EPOCH_NUMBER="4"
 ENV PIP_DEPENDENCIES_EPOCH_NUMBER=${PIP_DEPENDENCIES_EPOCH_NUMBER}
 
-# Install BATS and its dependencies for "in container" tests
-ARG BATS_VERSION="0.4.0"
-ARG BATS_SUPPORT_VERSION="0.3.0"
-ARG BATS_ASSERT_VERSION="2.0.0"
-ARG BATS_FILE_VERSION="0.2.0"
-
-RUN curl -sSL 
https://github.com/bats-core/bats-core/archive/v${BATS_VERSION}.tar.gz -o 
/tmp/bats.tgz \
-    && tar -zxf /tmp/bats.tgz -C /tmp \
-    && /bin/bash /tmp/bats-core-${BATS_VERSION}/install.sh /opt/bats && rm -rf
-
-RUN mkdir -p /opt/bats/lib/bats-support \
-    && curl -sSL 
https://github.com/bats-core/bats-support/archive/v${BATS_SUPPORT_VERSION}.tar.gz
 -o /tmp/bats-support.tgz \
-    && tar -zxf /tmp/bats-support.tgz -C /opt/bats/lib/bats-support --strip 1 
&& rm -rf /tmp/*
-
-RUN mkdir -p /opt/bats/lib/bats-assert \
-    && curl -sSL 
https://github.com/bats-core/bats-assert/archive/v${BATS_ASSERT_VERSION}.tar.gz 
-o /tmp/bats-assert.tgz \
-    && tar -zxf /tmp/bats-assert.tgz -C /opt/bats/lib/bats-assert --strip 1 && 
rm -rf /tmp/*
-
-RUN mkdir -p /opt/bats/lib/bats-file \
-    && curl -sSL 
https://github.com/bats-core/bats-file/archive/v${BATS_FILE_VERSION}.tar.gz -o 
/tmp/bats-file.tgz \
-    && tar -zxf /tmp/bats-file.tgz -C /opt/bats/lib/bats-file --strip 1 && rm 
-rf /tmp/*
-
-RUN echo "export PATH=/opt/bats/bin:${PATH}" >> /root/.bashrc
-
-# Additional scripts for managing BATS addons
-COPY scripts/ci/dockerfiles/bats/load.bash /opt/bats/lib/
-RUN chmod a+x /opt/bats/lib/load.bash
-
-
 # Optimizing installation of Cassandra driver
 # Speeds up building the image - cassandra driver without CYTHON saves around 
10 minutes
 ARG CASS_DRIVER_NO_CYTHON="1"
@@ -322,8 +293,6 @@ RUN chmod a+x /entrypoint
 # add it with ! in .dockerignore next to the airflow, test etc. directories 
there
 COPY . ${AIRFLOW_SOURCES}/
 
-
-
 # Install autocomplete for airflow
 RUN register-python-argcomplete airflow >> ~/.bashrc
 
diff --git a/STATIC_CODE_CHECKS.rst b/STATIC_CODE_CHECKS.rst
index b16ac06..a8ce69a 100644
--- a/STATIC_CODE_CHECKS.rst
+++ b/STATIC_CODE_CHECKS.rst
@@ -54,14 +54,6 @@ require Breeze Docker images to be installed locally:
 ----------------------------------- 
---------------------------------------------------------------- ------------
 ``build``                             Builds image for mypy, flake8.           
                            *
 ----------------------------------- 
---------------------------------------------------------------- ------------
-``bats-in-container-tests``           Run in Breeze container bats tests       
                            *
------------------------------------ 
---------------------------------------------------------------- ------------
-``black``                             Runs Black (the uncompromising Python 
code formatter)
------------------------------------ 
---------------------------------------------------------------- ------------
-``build``                             Builds image for mypy, pylint, flake8.   
                            *
------------------------------------ 
---------------------------------------------------------------- ------------
-``build-providers-dependencies``      Regenerates the json file with 
cross-provider dependencies
------------------------------------ 
---------------------------------------------------------------- ------------
 ``check-apache-license``              Checks compatibility with Apache License 
requirements.
 ----------------------------------- 
---------------------------------------------------------------- ------------
 ``check-builtin-literals``            Require literal syntax when initializing 
Python builtin types
diff --git a/breeze-complete b/breeze-complete
index 8b1d597..fd6cebd 100644
--- a/breeze-complete
+++ b/breeze-complete
@@ -68,7 +68,6 @@ all
 airflow-config-yaml
 base-operator
 bats-tests
-bats-in-container-tests
 black
 build
 check-apache-license
diff --git a/scripts/ci/pre_commit/pre_commit_in_container_bats_test.sh 
b/scripts/ci/pre_commit/pre_commit_in_container_bats_test.sh
deleted file mode 100755
index b699a54..0000000
--- a/scripts/ci/pre_commit/pre_commit_in_container_bats_test.sh
+++ /dev/null
@@ -1,30 +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.
-export FORCE_ANSWER_TO_QUESTIONS=${FORCE_ANSWER_TO_QUESTIONS:="quit"}
-export REMEMBER_LAST_ANSWER="true"
-export PRINT_INFO_FROM_SCRIPTS="false"
-export SKIP_CHECK_REMOTE_IMAGE="true"
-
-if [[ $# -eq 0 ]]; then
-    params=("tests/bats/in_container/")
-else
-    params=("${@}")
-fi
-
-# shellcheck source=scripts/ci/static_checks/in_container_bats_tests.sh
-. "$( dirname "${BASH_SOURCE[0]}" 
)/../static_checks/in_container_bats_tests.sh" "${params[@]}"
diff --git a/scripts/ci/static_checks/bats_tests.sh 
b/scripts/ci/static_checks/bats_tests.sh
index 72330e5..2066278 100755
--- a/scripts/ci/static_checks/bats_tests.sh
+++ b/scripts/ci/static_checks/bats_tests.sh
@@ -16,26 +16,13 @@
 # specific language governing permissions and limitations
 # under the License.
 # shellcheck source=scripts/ci/libraries/_script_init.sh
-
-#######################################################################################################
-# Runs tests for bash scripts in a docker container. This script is the 
entrypoint for the bats-tests
-# pre-commit hook where it runs all the bats tests (exluding in container 
tests).
-########################################################################################################
 function run_bats_tests() {
-    local bats_scripts=()
-    for script in "$@"
-    do
-        if [[ $script =~ \bats$ ]];
-        then
-            bats_scripts+=( "$script" )
-        fi
-    done
-    if [[ "${#@}" == "0" || "${#bats_scripts[@]}" != "${#@}" ]]; then
+    if [[ "${#@}" == "0" ]]; then
         docker run --workdir /airflow -v "$(pwd):/airflow" --rm \
-            apache/airflow:bats-2020.09.05-1.2.1 --tap /airflow/tests/bats/
+            apache/airflow:bats-2020.09.05-1.2.1 --tap -r /airflow/tests/bats
     else
         docker run --workdir /airflow -v "$(pwd):/airflow" --rm \
-            apache/airflow:bats-2020.09.05-1.2.1 --tap "${bats_scripts[@]}"
+            apache/airflow:bats-2020.09.05-1.2.1 --tap "${@}"
     fi
 }
 
diff --git a/scripts/ci/static_checks/in_container_bats_tests.sh 
b/scripts/ci/static_checks/in_container_bats_tests.sh
deleted file mode 100644
index a7c0121..0000000
--- a/scripts/ci/static_checks/in_container_bats_tests.sh
+++ /dev/null
@@ -1,41 +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.
-# shellcheck source=scripts/ci/libraries/_script_init.sh
-. "$( dirname "${BASH_SOURCE[0]}" )/../libraries/_script_init.sh"
-
-function run_in_container_bats_tests() {
-    if [[ "${#@}" == "0" ]]; then
-        docker run "${EXTRA_DOCKER_FLAGS[@]}" \
-        --entrypoint "/opt/bats/bin/bats"  \
-        "-v" "$(pwd):/airflow" \
-        "${AIRFLOW_CI_IMAGE}" \
-        --tap  "tests/bats/in_container/"
-    else
-        docker run "${EXTRA_DOCKER_FLAGS[@]}" \
-        --entrypoint "/opt/bats/bin/bats"  \
-        "-v" "$(pwd):/airflow" \
-        "${AIRFLOW_CI_IMAGE}" \
-        --tap "${@}"
-    fi
-}
-
-build_images::prepare_ci_build
-
-build_images::rebuild_ci_image_if_needed
-
-run_in_container_bats_tests "$@"
diff --git a/tests/bats/in_container/test_in_container.bats 
b/tests/bats/in_container/test_in_container.bats
deleted file mode 100644
index fe2e0c3..0000000
--- a/tests/bats/in_container/test_in_container.bats
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env bats
-
-
-# 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.
-# shellcheck disable=SC1091
-source "/opt/bats/lib/load.bash"
-
-setup() {
-# shellcheck source=scripts/in_container/_in_container_utils.sh
-    source "${AIRFLOW_SOURCES}/scripts/in_container/_in_container_utils.sh"
-}
-
-@test "test in_container" {
-    run assert_in_container
-    assert [ $status -eq 0 ]
-}
diff --git a/tests/bats/test_empty_test.bats b/tests/bats/test_empty_test.bats
index 2830014..2a4f680 100644
--- a/tests/bats/test_empty_test.bats
+++ b/tests/bats/test_empty_test.bats
@@ -17,7 +17,6 @@
 # specific language governing permissions and limitations
 # under the License.
 
-
 @test "empty test" {
   load bats_utils
 

Reply via email to