From 4816808bd9a4bd529fd900645684ab15c7fdc754 Mon Sep 17 00:00:00 2001 From: Dmitry Kruchinin <33020454+dvkruchinin@users.noreply.github.com> Date: Tue, 22 Dec 2020 11:51:42 +0300 Subject: [PATCH] Fix migration error in CRON type of CI. (#2606) * Wait response from API `/server/about` before creating superuser in cron tests Co-authored-by: Kruchinin --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 207d155ee69..cc72db8c4eb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,6 +23,7 @@ env: DJANGO_SU_EMAIL="admin@localhost.company" DJANGO_SU_PASSWORD="12qwaszx" NODE_VERSION="12" + API_ABOUT_PAGE="localhost:8080/api/v1/server/about" before_install: - nvm install ${NODE_VERSION} @@ -34,7 +35,7 @@ script: - if [[ $TRAVIS_EVENT_TYPE == "cron" && $TRAVIS_BRANCH == "develop" ]]; then docker-compose -f docker-compose.yml -f ./tests/docker-compose.email.yml up -d --build; - docker exec -it cvat bash -ic 'python3 ~/manage.py migrate'; + bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' ${API_ABOUT_PAGE})" != "401" ]]; do sleep 5; done'; docker exec -it cvat bash -ic "echo \"from django.contrib.auth.models import User; User.objects.create_superuser('${DJANGO_SU_NAME}', '${DJANGO_SU_EMAIL}', '${DJANGO_SU_PASSWORD}')\" | python3 ~/manage.py shell"; cd ./tests && npm install && npm run cypress:run:firefox; exit $?; fi;