Skip to content

Commit

Permalink
Fix preparations for testing of API.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomascapek committed Dec 2, 2024
1 parent 1fbfc78 commit 6091e14
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10

services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test_db
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Check out repository code
uses: actions/checkout@v2
Expand All @@ -31,5 +46,7 @@ jobs:
run: |
poetry install
- name: Run test suite
env:
TEST_DATABASE_URL: postgres://postgres:postgres@localhost:5432/test_db
run: |
poetry run pytest -v
1 change: 0 additions & 1 deletion rhinventory/service/asset/tests/fixtures.py

This file was deleted.

File renamed without changes.
5 changes: 3 additions & 2 deletions rhinventory/service/test_common.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from sqlalchemy import text


def test_db_running(db_session):
def test_db_running(test_db_session):
"""Test whether testing DB is running."""
assert db_session.execute('SELECT 1')
assert test_db_session.execute(text('SELECT 1'))

0 comments on commit 6091e14

Please sign in to comment.