Skip to content

Commit

Permalink
Added test database connection script
Browse files Browse the repository at this point in the history
  • Loading branch information
FredMagas committed Aug 8, 2024
1 parent 8589038 commit c6fd116
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ jobs:
source venv/bin/activate
pip install -r requirements.txt
- name: Test database connection
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
run: |
source venv/bin/activate
python test_db_connection.py
- name: Make retry.sh executable
run: chmod +x retry.sh

Expand Down
11 changes: 11 additions & 0 deletions test_db_connection.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import psycopg2
import os

DATABASE_URL = os.getenv('DATABASE_URL')

try:
conn = psycopg2.connect(DATABASE_URL)
print("Connection successful")
except Exception as e:
print(f"Connection failed: {e}")
exit(1)

0 comments on commit c6fd116

Please sign in to comment.