Skip to content

Commit

Permalink
remove pg in tests, use sqlite instead
Browse files Browse the repository at this point in the history
This will really solve the issue of external contributors tests failing, and is simpler.
  • Loading branch information
eric-intuitem committed May 6, 2024
1 parent 67bdb14 commit a40dc64
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 56 deletions.
19 changes: 0 additions & 19 deletions .github/workflows/backend-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,6 @@ jobs:
env:
working-directory: ./backend

services:
postgres:
image: postgres:14.1
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
POSTGRES_DB: postgres
ports: ["5432:5432"]
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

strategy:
max-parallel: 4
matrix:
Expand All @@ -46,12 +36,7 @@ jobs:
working-directory: ${{env.working-directory}}
run: |
touch .env
echo DJANGO_SECRET_KEY=${{ secrets.DJANGO_SECRET_KEY }} >> .env
echo DJANGO_DEBUG='True' >> .env
echo POSTGRES_NAME=postgres >> .env
echo POSTGRES_USER=postgres >> .env
echo POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }} >> .env
echo DB_HOST=localhost >> .env
echo EMAIL_HOST=localhost >> .env
echo EMAIL_PORT=1025 >> .env
echo EMAIL_HOST_USER='' >> .env
Expand All @@ -67,13 +52,9 @@ jobs:
python manage.py migrate
- name: Run coverage
working-directory: ${{env.working-directory}}
env:
DATABASE_URL: "postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/postgres"
run: |
export $(grep -v '^#' .env | xargs)
find . -path '*/tests/*' -and -name 'test*.py' -and -not -path "./venv/*" | xargs coverage run -m pytest
- name: Display coverage report
working-directory: ${{env.working-directory}}
env:
DATABASE_URL: "postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/postgres"
run: coverage report
21 changes: 0 additions & 21 deletions .github/workflows/functional-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,6 @@ jobs:
backend-directory: ./backend
working-directory: ./frontend

services:
postgres:
image: postgres:14.1
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
POSTGRES_DB: postgres
ports: ["5432:5432"]
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
mailhog:
image: mailhog/mailhog
ports: [
"1025:1025",
"8025:8025"
]

strategy:
max-parallel: 4
matrix:
Expand Down Expand Up @@ -68,13 +52,8 @@ jobs:
working-directory: ${{ env.backend-directory }}
run: |
touch .env
echo DJANGO_SECRET_KEY=${{ secrets.DJANGO_SECRET_KEY }} >> .env
echo [email protected] >> .env
echo DJANGO_SUPERUSER_PASSWORD=1234 >> .env
echo POSTGRES_NAME=postgres >> .env
echo POSTGRES_USER=postgres >> .env
echo POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }} >> .env
echo DB_HOST=localhost >> .env
echo CISO_ASSISTANT_SUPERUSER_EMAIL='' >> .env
echo CISO_ASSISTANT_URL=http://localhost:4173 >> .env
echo DEFAULT_FROM_EMAIL='[email protected]' >> .env
Expand Down
16 changes: 0 additions & 16 deletions .github/workflows/startup-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,6 @@ jobs:
startup-functional-test:
runs-on: ubuntu-20.04

services:
postgres:
image: postgres:14.1
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports: ["5432:5432"]
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

strategy:
max-parallel: 4
matrix:
Expand Down Expand Up @@ -60,13 +50,8 @@ jobs:
working-directory: ${{ env.backend-directory }}
run: |
touch .env
echo DJANGO_SECRET_KEY=${{ secrets.DJANGO_SECRET_KEY }} >> .env
echo [email protected] >> .env
echo DJANGO_SUPERUSER_PASSWORD=1234 >> .env
echo POSTGRES_NAME=postgres >> .env
echo POSTGRES_USER=postgres >> .env
echo POSTGRES_PASSWORD=postgres >> .env
echo DB_HOST=localhost >> .env
echo CISO_ASSISTANT_SUPERUSER_EMAIL='' >> .env
echo CISO_ASSISTANT_URL=http://localhost:4173 >> .env
- name: Run migrations
Expand Down Expand Up @@ -114,7 +99,6 @@ jobs:
working-directory: ${{ env.backend-directory }}
run: |
touch .env
echo DJANGO_SECRET_KEY=${{ secrets.DJANGO_SECRET_KEY }} >> .env
export $(grep -v '^#' .env | xargs)
- name: Config the Docker app
run: |
Expand Down

0 comments on commit a40dc64

Please sign in to comment.