Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GTC-2864 Make test output for Data API be less verbose by default #548

Merged
merged 5 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/terraform_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:

- name: Test with pytest
run: |
./scripts/test
./scripts/test_v2 --no_build
./scripts/test --do-cov --show-warnings
./scripts/test_v2 --no_build --do-cov --show-warnings

- name: Run codacy-coverage-reporter
uses: codacy/codacy-coverage-reporter-action@master
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ services:
- API_GATEWAY_STAGE_NAME=test
- AWS_GCS_KEY_SECRET_ARN=testing
- AWS_SECRETSMANAGER_URL=http://motoserver:50000
entrypoint: wait_for_postgres.sh pytest --timeout 480 -vv --cov-report term --cov=app
entrypoint: wait_for_postgres.sh pytest --timeout 480 -vv --cov-report term
depends_on:
- test_database_12
- motoserver
Expand Down
24 changes: 23 additions & 1 deletion scripts/test
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ set -e
# Default values
POSITIONAL=()
BUILD=true
DO_COV=
DISABLE_WARNINGS="--disable-warnings"
SHOW_STDOUT=
# extracting cmd line arguments
while [[ $# -gt 0 ]]
do
Expand All @@ -24,6 +27,18 @@ do
SLOW=--with-slow-tests
shift # past argument
;;
--do-cov)
DO_COV=--cov=app
shift # past argument
;;
--show-warnings)
DISABLE_WARNINGS=
shift # past argument
;;
--show-stdout)
SHOW_STDOUT=--capture=no
shift # past argument
;;
--moto-port=*)
# prevent port binding issues by explicitly setting the motoserver s3 port
# https://developer.apple.com/forums/thread/682332
Expand All @@ -38,6 +53,11 @@ do
done
set -- "${POSITIONAL[@]}" # restore positional parameters

# If no tests specified, do whole tests directory
args=$*
if [ $# -eq 0 ]; then
args=tests
fi

if [ "${BUILD}" = true ]; then
docker build -t batch_gdal-python_test . -f batch/gdal-python.dockerfile
Expand All @@ -48,7 +68,9 @@ if [ "${BUILD}" = true ]; then
fi

set +e
docker-compose -f docker-compose.test.yml --project-name gfw-data-api_test run --rm --name app_test app_test $HANGING $SLOW --cov-report xml:/app/tests/cobertura.xml tests/"$*"

# Everything from "--cov-report on" become the arguments to the pytest run inside the docker.
docker-compose -f docker-compose.test.yml --project-name gfw-data-api_test run --rm --name app_test app_test --cov-report xml:/app/tests/cobertura.xml $HANGING $SLOW $DO_COV $DISABLE_WARNINGS $SHOW_STDOUT $args
exit_code=$?
docker-compose -f docker-compose.test.yml --project-name gfw-data-api_test down --remove-orphans
exit $exit_code
24 changes: 19 additions & 5 deletions scripts/test_v2
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ set -e
# Default values
POSITIONAL=()
BUILD=true
DO_COV=
DISABLE_WARNINGS="--disable-warnings"
SHOW_STDOUT=
# extracting cmd line arguments
while [[ $# -gt 0 ]]
do
Expand All @@ -16,12 +19,16 @@ do
BUILD=false
shift # past argument
;;
--without-hanging-tests)
HANGING=--without-hanging-tests
--do-cov)
DO_COV=--cov=app
shift # past argument
;;
--with-slow-tests)
SLOW=--with-slow-tests
--show-warnings)
DISABLE_WARNINGS=
shift # past argument
;;
--show-stdout)
SHOW_STDOUT=--capture=no
shift # past argument
;;
--moto-port=*)
Expand All @@ -38,6 +45,11 @@ do
done
set -- "${POSITIONAL[@]}" # restore positional parameters

# If no tests specified, do whole tests_v2 directory
args=$*
if [ $# -eq 0 ]; then
args=tests_v2
fi

if [ "${BUILD}" = true ]; then
docker build -t batch_gdal-python_test . -f batch/gdal-python.dockerfile
Expand All @@ -48,7 +60,9 @@ if [ "${BUILD}" = true ]; then
fi

set +e
docker-compose -f docker-compose.test.yml --project-name gfw-data-api_test run --rm --name app_test app_test --cov-report xml:/app/tests_v2/cobertura.xml tests_v2/"$*"

# Everything from "--cov-report on" become the arguments to the pytest run inside the docker.
docker-compose -f docker-compose.test.yml --project-name gfw-data-api_test run --rm --name app_test app_test --cov-report xml:/app/tests_v2/cobertura.xml $DO_COV $DISABLE_WARNINGS $SHOW_STDOUT $args
exit_code=$?
docker-compose -f docker-compose.test.yml --project-name gfw-data-api_test down --remove-orphans
exit $exit_code
Loading