-
Notifications
You must be signed in to change notification settings - Fork 3
Closed
Labels
Description
Description
The current test setup has several critical issues that prevent tests from running successfully:
Current Problems:
- Permission Error: Tests fail with
PermissionError: [Errno 13] Permission denied: '/logs'because the test container tries to create/logsdirectory without proper permissions - Test Structure: Tests are currently located in
backend/tests/which creates import path issues and makes the test structure confusing - Import Issues:
conftest.pyimports frommainwhich tries to create log directories during import time - Complex Test Organization: Current structure has 20+ test directories with hundreds of tests and fixtures, making maintenance difficult
Proposed Solution:
- Move tests/ to project root (
/testsinstead of/backend/tests) - Optimize test structure by consolidating related tests and removing redundant fixtures
- Fix permission issues by ensuring proper volume mounting and directory permissions
- Update Makefile to support both full test runs and targeted test execution
- Simplify test organization to focus on core functionality coverage
Required Changes:
1. Directory Structure Changes:
/tests/ # Move from /backend/tests/
├── conftest.py # Updated with proper imports
├── unit/ # Core unit tests
├── integration/ # Integration tests
├── api/ # API endpoint tests
├── fixtures/ # Essential test fixtures only
└── utils/ # Test utilities
2. Makefile Updates:
- Add
make test testfile=path/to/test.pyfor specific test files - Add
make test testfile=path/to/test.py::test_namefor specific test functions - Update volume mounting to fix permission issues
- Ensure proper test directory creation
3. Docker Configuration:
- Update test container to handle log directory permissions properly
- Fix volume mounting for test reports and source code
4. Import Path Updates:
- Update all test imports to use new structure
- Fix
conftest.pyto avoid importing main application during test setup
Benefits:
- ✅ All tests will pass without permission errors
- ✅ Cleaner, more maintainable test structure
- ✅ Better test isolation and organization
- ✅ Easier to run specific tests or test suites
- ✅ Improved CI/CD pipeline reliability
Labels:
- bug
- tests
- refactor
- docker