This removes all error-catching from the test scripts. If unit tests fail, the script will exit immediately. The error catching functionality was not working correctly using the sh shell in Alpine inside the containers, and so CI was allowed to continue after test failures.
48 lines
1.3 KiB
Plaintext
48 lines
1.3 KiB
Plaintext
# run_test: Execute code checkers and unit tests
|
|
|
|
# Load test functions
|
|
source ./script/include/test_functions.inc.sh
|
|
|
|
## Set option defaults
|
|
# If PYTHON_FILES is not set, give it the default value of "app.py"
|
|
if [ -z "${PYTHON_FILES+is_set}" ]; then
|
|
PYTHON_FILES="app.py"
|
|
fi
|
|
|
|
# reset test database
|
|
if [ "${RESET_DB}" = "true" ]; then
|
|
# Fetch postgres settings and set them as ENV vars
|
|
source ./script/get_db_settings
|
|
|
|
if [ -n "${PGDATABASE}" ]; then
|
|
output_divider "Reset database ${PGDATABASE}"
|
|
# Reset the db
|
|
reset_db "${PGDATABASE}"
|
|
else
|
|
warning "warning: RESET_DB is set, but PGDATABASE is not!"
|
|
warning "Skipping database reset..."
|
|
fi
|
|
fi
|
|
|
|
## Main
|
|
if [ "${RUN_PYTHON_TESTS}" = "true" ]; then
|
|
|
|
output_divider "Lint Python files"
|
|
run_python_lint "${PYTHON_FILES}"
|
|
output_divider "Perform static analysis on Python files"
|
|
run_python_static_analysis "${PYTHON_FILES}"
|
|
output_divider "Perform type checking on Python files"
|
|
run_python_typecheck
|
|
output_divider "Run Python unit test suite"
|
|
run_python_unit_tests "${PYTHON_FILES}"
|
|
|
|
fi
|
|
|
|
if [ "${RUN_JS_TESTS}" = "true" ]; then
|
|
output_divider "Render Vue components"
|
|
mkdir js/test_templates | true
|
|
run_python_render_vue_component
|
|
output_divider "Run JavaScript unit test suite"
|
|
run_javascript_tests
|
|
fi
|