fix: refactor db migration tests

This commit is contained in:
Jun Siang Cheah 2024-04-28 16:59:48 +01:00
parent eed6c7194b
commit f561e94244

View file

@ -106,9 +106,12 @@ jobs:
- name: Test backend with SQLite - name: Test backend with SQLite
id: sqlite id: sqlite
env:
WEBUI_SECRET_KEY: secret-key
GLOBAL_LOG_LEVEL: debug
run: | run: |
cd backend cd backend
WEBUI_SECRET_KEY=secret-key GLOBAL_LOG_LEVEL=debug uvicorn main:app --port "8080" --forwarded-allow-ips '*' & uvicorn main:app --port "8080" --forwarded-allow-ips '*' &
UVICORN_PID=$! UVICORN_PID=$!
# Wait up to 20 seconds for the server to start # Wait up to 20 seconds for the server to start
for i in {1..20}; do for i in {1..20}; do
@ -130,10 +133,13 @@ jobs:
- name: Test backend with Postgres - name: Test backend with Postgres
if: success() || steps.sqlite.conclusion == 'failure' if: success() || steps.sqlite.conclusion == 'failure'
env:
WEBUI_SECRET_KEY: secret-key
GLOBAL_LOG_LEVEL: debug
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/postgres
run: | run: |
cd backend cd backend
export DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres uvicorn main:app --port "8081" --forwarded-allow-ips '*' &
WEBUI_SECRET_KEY=secret-key GLOBAL_LOG_LEVEL=debug uvicorn main:app --port "8081" --forwarded-allow-ips '*' &
UVICORN_PID=$! UVICORN_PID=$!
# Wait up to 20 seconds for the server to start # Wait up to 20 seconds for the server to start
for i in {1..20}; do for i in {1..20}; do
@ -154,10 +160,13 @@ jobs:
# - name: Test backend with MySQL # - name: Test backend with MySQL
# if: success() || steps.sqlite.conclusion == 'failure' || steps.postgres.conclusion == 'failure' # if: success() || steps.sqlite.conclusion == 'failure' || steps.postgres.conclusion == 'failure'
# env:
# WEBUI_SECRET_KEY: secret-key
# GLOBAL_LOG_LEVEL: debug
# DATABASE_URL: mysql://root:mysql@localhost:3306/mysql
# run: | # run: |
# cd backend # cd backend
# export DATABASE_URL=mysql://root:mysql@localhost:3306/mysql # uvicorn main:app --port "8083" --forwarded-allow-ips '*' &
# WEBUI_SECRET_KEY=secret-key GLOBAL_LOG_LEVEL=debug uvicorn main:app --port "8083" --forwarded-allow-ips '*' &
# UVICORN_PID=$! # UVICORN_PID=$!
# # Wait up to 20 seconds for the server to start # # Wait up to 20 seconds for the server to start
# for i in {1..20}; do # for i in {1..20}; do