From d532077f8c0abb70879a6c13b73a9c7fbfd95d09 Mon Sep 17 00:00:00 2001 From: Dmitry Yakhnov Date: Fri, 25 Sep 2020 22:12:20 +1000 Subject: [PATCH] Update tests --- test.sh | 93 +++++++++++++++++++++++++++++++-------------------------- 1 file changed, 50 insertions(+), 43 deletions(-) diff --git a/test.sh b/test.sh index 6f718eb3bf..c124b1dd89 100644 --- a/test.sh +++ b/test.sh @@ -10,67 +10,74 @@ function run_test { python test.py test --settings=$1 result=$? if [ "$TEST_TYPE" == "memory" ]; then - if [ -n "$PULL_REQUEST_NUMBER" ]; then - export TRAVIS_PULL_REQUEST=$PULL_REQUEST_NUMBER; - else export TRAVIS_PULL_REQUEST='false'; fi - if [ -v COVERALLS_REPO_TOKEN ]; then - coveralls - fi - if [ -v CODACY_PROJECT_TOKEN ]; then - coverage xml - python-codacy-coverage -r coverage.xml - fi + if [ -n "$PULL_REQUEST_NUMBER" ]; then + export TRAVIS_PULL_REQUEST=$PULL_REQUEST_NUMBER; + else + export TRAVIS_PULL_REQUEST='false'; + fi + if [ -v COVERALLS_REPO_TOKEN ]; then + coveralls + fi + if [ -v CODACY_PROJECT_TOKEN ]; then + coverage xml + python-codacy-coverage -r coverage.xml + fi fi return $result } case "$TEST_TYPE" in memory) - run_test tardis.test_settings - (( exit_status = exit_status || $? )) - ;; + run_test tardis.test_settings + (( exit_status = exit_status || $? )) + ;; pg) - run_test tardis.test_on_postgresql_settings - (( exit_status = exit_status || $? )) - ;; + run_test tardis.test_on_postgresql_settings + (( exit_status = exit_status || $? )) + ;; mysql) - run_test tardis.test_on_mysql_settings - (( exit_status = exit_status || $? )) - ;; + run_test tardis.test_on_mysql_settings + (( exit_status = exit_status || $? )) + ;; pylint) - pylint --rcfile .pylintrc tardis - (( exit_status = exit_status || $? )) - ;; + pylint --rcfile .pylintrc tardis + (( exit_status = exit_status || $? )) + ;; behave) - npm install && npm audit --audit-level=high --production && npm run-script build && \ - npm test && python test.py behave - (( exit_status = exit_status || $? )) - ;; + npm install && \ + npm audit --audit-level=high --production && \ + npm run-script build && \ + npm test && \ + python test.py behave + (( exit_status = exit_status || $? )) + ;; templates) echo $'Validating templates...\n' && \ DJANGO_SETTINGS_MODULE=tardis.test_settings python manage.py validate_templates && \ echo $'\nChecking for tabs in templates...\n' && \ ! grep -r $'\t' tardis/tardis_portal/templates/* && \ echo $'\nChecking for duplication in templates...\n' && \ - npm install --no-package-lock --no-save jscpd && \ - $(npm bin)/jscpd --reporters consoleFull --min-lines 20 \ - --threshold 0 tardis/tardis_portal/templates/ && + npm install --no-package-lock --no-save jscpd && \ + $(npm bin)/jscpd --reporters consoleFull --min-lines 20 --threshold 0 tardis/tardis_portal/templates/ && echo $'\nRunning bootlint on templates...\n' && \ - # npm install --no-package-lock --no-save bootlint && \ - # $(npm bin)/bootlint --disable E001,E041,E047,W001,W002,W003,W005 \ - # tardis/tardis_portal/templates/tardis_portal/*.html - (( exit_status = exit_status || $? )) - ;; + (( exit_status = exit_status || $? )) + ;; *) - run_test tardis.test_settings - (( exit_status = exit_status || $? )) - run_test tardis.test_on_postgresql_settings - (( exit_status = exit_status || $? )) - run_test tardis.test_on_mysql_settings - (( exit_status = exit_status || $? )) - pylint --rcfile .pylintrc tardis - (( exit_status = exit_status || $? )) - ;; + run_test tardis.test_settings + (( exit_status = exit_status || $? )) + run_test tardis.test_on_postgresql_settings + (( exit_status = exit_status || $? )) + run_test tardis.test_on_mysql_settings + (( exit_status = exit_status || $? )) + pylint --rcfile .pylintrc tardis + (( exit_status = exit_status || $? )) + npm install && \ + npm audit --audit-level=high --production && \ + npm run-script build && \ + npm test && \ + python test.py behave + (( exit_status = exit_status || $? )) + ;; esac exit $exit_status