Skip to content

Commit 16458b5

Browse files
committed
ci: fix test config and JWT secret module caching
- Add App.test.js to testPathIgnorePatterns in workflows to match local scripts - Fix conftest.py to delete config/middleware modules from sys.modules cache - Ensures JWT_SECRET test env var is read by config.py instead of cached default - Fixes 401 UNAUTHORIZED failures in backend integration tests
1 parent 7171611 commit 16458b5

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

.github/workflows/ci-quick.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ jobs:
131131
run: |
132132
cd frontend
133133
npm test -- --watchAll=false --maxWorkers=4 \
134-
--testPathIgnorePatterns='Canvas.test.js|Dashboard.test.js' \
134+
--testPathIgnorePatterns='Canvas.test.js|Dashboard.test.js|App.test.js' \
135135
--coverage=false \
136136
--ci
137137

.github/workflows/ci-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ jobs:
174174
run: |
175175
cd frontend
176176
npm test -- --watchAll=false --maxWorkers=4 \
177-
--testPathIgnorePatterns='Canvas.test.js|Dashboard.test.js' \
177+
--testPathIgnorePatterns='Canvas.test.js|Dashboard.test.js|App.test.js' \
178178
--coverage --ci
179179
180180
- name: Upload coverage to Codecov

backend/tests/conftest.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,24 @@
2020
def app(mock_redis, mock_mongodb):
2121
# Import app AFTER mocks are set up to ensure patched services.db is used
2222
import sys
23-
# Force reimport of services.db module if it was already imported
24-
if 'services.db' in sys.modules:
25-
del sys.modules['services.db']
26-
if 'app' in sys.modules:
27-
del sys.modules['app']
23+
# Force reimport of all backend modules to pick up test environment variables
24+
modules_to_delete = [
25+
'services.db',
26+
'app',
27+
'config',
28+
'middleware.auth',
29+
'routes.auth',
30+
'routes.rooms',
31+
'routes.new_line',
32+
'routes.get_canvas_data',
33+
'routes.submit_room_line',
34+
'routes.undo_redo',
35+
'routes.clear_canvas',
36+
'routes.socketio_handlers',
37+
]
38+
for module_name in modules_to_delete:
39+
if module_name in sys.modules:
40+
del sys.modules[module_name]
2841

2942
from app import app as flask_app
3043
flask_app.config.update({

0 commit comments

Comments
 (0)