Hotfix for CI-nightly (#74)

main
Kirill Sizov 4 years ago committed by GitHub
parent 2e161b0e9f
commit ca8150e21c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -7,9 +7,6 @@ on:
pull_request: pull_request:
types: [edited, ready_for_review, opened, synchronize, reopened] types: [edited, ready_for_review, opened, synchronize, reopened]
env:
API_ABOUT_PAGE: "localhost:8080/api/server/about"
jobs: jobs:
cache: cache:
if: | if: |
@ -191,11 +188,7 @@ jobs:
npm run coverage npm run coverage
docker-compose -f docker-compose.yml -f docker-compose.dev.yml -f components/serverless/docker-compose.serverless.yml build cvat_ui docker-compose -f docker-compose.yml -f docker-compose.dev.yml -f components/serverless/docker-compose.serverless.yml build cvat_ui
- name: Running e2e tests - name: Run CVAT instance for E2E testing
env:
DJANGO_SU_NAME: 'admin'
DJANGO_SU_EMAIL: 'admin@localhost.company'
DJANGO_SU_PASSWORD: '12qwaszx'
run: | run: |
docker-compose \ docker-compose \
-f docker-compose.yml \ -f docker-compose.yml \
@ -203,12 +196,29 @@ jobs:
-f components/serverless/docker-compose.serverless.yml \ -f components/serverless/docker-compose.serverless.yml \
-f tests/docker-compose.file_share.yml up -d -f tests/docker-compose.file_share.yml up -d
/bin/bash -c \ - name: Waiting for server
'while [[ $(curl -s -o /dev/null -w "%{http_code}" ${{ env.API_ABOUT_PAGE }}) != "401" ]]; do sleep 5; done' env:
API_ABOUT_PAGE: "localhost:8080/api/server/about"
run: |
max_tries=60
status_code=$(curl -s -o /tmp/server_response -w "%{http_code}" ${API_ABOUT_PAGE})
while [[ $status_code != "401" && max_tries -gt 0 ]]
do
echo Number of attempts left: $max_tries
echo Status code of response: $status_code
sleep 5
status_code=$(curl -s -o /tmp/server_response -w "%{http_code}" ${API_ABOUT_PAGE})
(( max_tries-- ))
done
docker exec -i cvat \ - name: Run E2E tests
/bin/bash -c \ env:
"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" DJANGO_SU_NAME: 'admin'
DJANGO_SU_EMAIL: 'admin@localhost.company'
DJANGO_SU_PASSWORD: '12qwaszx'
run: |
docker exec -i cvat /bin/bash -c "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 cd ./tests
npm ci npm ci

@ -21,7 +21,7 @@ jobs:
-d $(gh api /repos/${REPO}/branches/${default_branch} | jq -r '.commit.commit.author.date')) -d $(gh api /repos/${REPO}/branches/${default_branch} | jq -r '.commit.commit.author.date'))
last_night_time=$(date +%s \ last_night_time=$(date +%s \
-d $(gh api /repos/${REPO}/actions/workflows/caching.yml/runs | jq -r '.workflow_runs[].updated_at' | sort | tail -1)) -d $(gh api /repos/${REPO}/actions/workflows/schedule.yml/runs | jq -r '.workflow_runs[].updated_at' | sort | tail -1))
echo ::set-output name=last_commit_time::${last_commit_time} echo ::set-output name=last_commit_time::${last_commit_time}
echo ::set-output name=last_night_time::${last_night_time} echo ::set-output name=last_night_time::${last_night_time}
@ -130,15 +130,37 @@ jobs:
pytest tests/rest_api/ pytest tests/rest_api/
pytest tests/rest_api/ --stop-services pytest tests/rest_api/ --stop-services
- name: Build CVAT - name: Run CVAT
run: |
docker-compose -f docker-compose.yml -f docker-compose.dev.yml -f ./tests/docker-compose.email.yml -f tests/docker-compose.file_share.yml -f components/serverless/docker-compose.serverless.yml up -d --build
- name: Waiting for server
env:
API_ABOUT_PAGE: "localhost:8080/api/server/about"
run: |
max_tries=60
status_code=$(curl -s -o /tmp/server_response -w "%{http_code}" ${API_ABOUT_PAGE})
while [[ $status_code != "401" && max_tries -gt 0 ]]
do
echo Number of attempts left: $max_tries
echo Status code of response: $status_code
sleep 5
status_code=$(curl -s -o /tmp/server_response -w "%{http_code}" ${API_ABOUT_PAGE})
(( max_tries-- ))
done
if [[ $status_code != "401" ]]; then
echo Response from server is incorrect, output:
cat /tmp/server_response
fi
- name: Add user for tests
env: env:
DJANGO_SU_NAME: "admin" DJANGO_SU_NAME: "admin"
DJANGO_SU_EMAIL: "admin@localhost.company" DJANGO_SU_EMAIL: "admin@localhost.company"
DJANGO_SU_PASSWORD: "12qwaszx" DJANGO_SU_PASSWORD: "12qwaszx"
API_ABOUT_PAGE: "localhost:8080/api/server/about"
run: | run: |
docker-compose -f docker-compose.yml -f docker-compose.dev.yml -f ./tests/docker-compose.email.yml -f tests/docker-compose.file_share.yml -f components/serverless/docker-compose.serverless.yml up -d --build
/bin/bash -c 'while [[ $(curl -s -o /dev/null -w "%{http_code}" ${API_ABOUT_PAGE}) != "401" ]]; do sleep 5; done'
docker exec -i cvat /bin/bash -c "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" docker exec -i cvat /bin/bash -c "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"
- name: End-to-end testing - name: End-to-end testing

@ -2,6 +2,7 @@ import os.path as osp
import re import re
from http import HTTPStatus from http import HTTPStatus
from subprocess import PIPE, CalledProcessError, run from subprocess import PIPE, CalledProcessError, run
from time import sleep
import pytest import pytest
import os import os
@ -96,10 +97,11 @@ def delete_compose_files():
def wait_for_server(): def wait_for_server():
while True: for _ in range(60):
response = requests.get(get_api_url("users/self")) response = requests.get(get_api_url("users/self"))
if response.status_code == HTTPStatus.UNAUTHORIZED: if response.status_code == HTTPStatus.UNAUTHORIZED:
break break
sleep(5)
def restore_data_volumes(): def restore_data_volumes():
docker_cp(osp.join(CVAT_DB_DIR, "cvat_data.tar.bz2"), f"{PREFIX}_cvat_1:/tmp/cvat_data.tar.bz2") docker_cp(osp.join(CVAT_DB_DIR, "cvat_data.tar.bz2"), f"{PREFIX}_cvat_1:/tmp/cvat_data.tar.bz2")

Loading…
Cancel
Save