Skip to content

Commit

Permalink
[ AIRFLOW-4554] Test for sudo command, add some other test docs (apac…
Browse files Browse the repository at this point in the history
…he#5310)

* AIRFLOW-4554 Unit tests use sudo conditionally
  • Loading branch information
dossett authored and potiuk committed May 23, 2019
1 parent 03ee1c3 commit 4856353
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
13 changes: 10 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,12 @@ There are three ways to setup an Apache Airflow development environment.
# Start docker in your Airflow directory
docker run -t -i -v `pwd`:/airflow/ -w /airflow/ python:3 bash
# Install Airflow with all the required dependencies,
# including the devel which will provide the development tools
pip install -e '.[hdfs,hive,druid,devel]'
# To install all of airflows dependencies to run all tests (this is a lot)
pip install -e .
# To run only certain tests install the devel requirements and whatever is required
# for your test. See setup.py for the possible requirements. For example:
pip install -e '.[gcp,devel]'
# Init the database
airflow initdb
Expand Down Expand Up @@ -190,6 +193,10 @@ or a single test method:
```
./run_unit_tests.sh tests.core:CoreTest.test_check_operators -s --logging-level=DEBUG
```
or another example:
```
./run_unit_tests.sh tests.contrib.operators.test_dataproc_operator:DataprocClusterCreateOperatorTest.test_create_cluster_deletes_error_cluster -s --logging-level=DEBUG
```

To run the whole test suite with Docker Compose, do:

Expand Down
9 changes: 7 additions & 2 deletions run_unit_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,13 @@ if [ -f "${AIRFLOW_DB}" ]; then
fi

# For impersonation tests on Travis, make airflow accessible to other users via the global PATH
# (which contains /usr/local/bin)
sudo ln -sf "${VIRTUAL_ENV}/bin/airflow" /usr/local/bin/
# (which contains /usr/local/bin). Some test environments, like the docker instructions, won't have sudo and
# are probably running as root anyway
if command -v sudo > /dev/null; then
sudo ln -sf "${VIRTUAL_ENV}/bin/airflow" /usr/local/bin/
else
ln -sf "${VIRTUAL_ENV}/bin/airflow" /usr/local/bin/
fi

echo "Starting the unit tests with the following nose arguments: "$nose_args
nosetests $nose_args
Expand Down

0 comments on commit 4856353

Please sign in to comment.