Add isolated testing settings for awx testing#16110
Add isolated testing settings for awx testing#16110tyraziel wants to merge 1 commit intoansible:develfrom
Conversation
Introduces settings_for_isolated_testing.py to provide a self-contained
test environment for awx testing.
Key Features:
- SQLite database configuration for faster, isolated test runs
- ServiceID mocking infrastructure to prevent UUID validation errors
- Resource server sync disabling to avoid authentication errors in tests
- Memory-based caching for test isolation
Testing Infrastructure Patterns:
- Sample mock_dab_service_id() fixture for ServiceID.objects.first() calls
- MOCK_DAB_SERVICE_ID setting to enable/disable mocking conditionally
- RESOURCE_SERVER = {} configuration to disable external sync during testing
- Comprehensive documentation for reuse in future DAB-related testing
This testing foundation enables reliable unit and integration testing
of django-ansible-base components without requiring external PostgreSQL
databases or live service dependencies.
Usage: pytest --ds=awx.main.tests.settings_for_isolated_testing
🤖 Generated with [Claude Code](https://claude.ai/code)
Vibe-Coder: Andrew Potozniak <[email protected]>
Co-Authored-By: Claude <[email protected]>
|
| pytest --ds=awx.main.tests.settings_for_isolated_testing [test_file] | ||
|
|
||
| Enhanced Usage Notes: | ||
| 1. ServiceID Mocking Pattern: |
There was a problem hiding this comment.
I see this fixure in the comments. Why not include it in the PR? We aren't seeing tests fail in our CI because of ServiceID record not existing. Wondering why you are seeing it.
As I understand it a ServiceId record is supposed to be created via DAB migrations here https://github.com/ansible/django-ansible-base/blob/964c531cdb465ca9b0511ee75e2772bd3847ddc6/ansible_base/resource_registry/migrations/0001_initial.py#L31
|
This file is very close to being a duplicate of https://github.com/ansible/awx/blob/devel/awx/main/tests/settings_for_test.py It looks like the main difference is |
SUMMARY
Introduces settings_for_isolated_testing.py to provide a self-contained test environment for awx testing.
Key Features:
Testing Infrastructure Patterns:
This testing foundation enables reliable unit and integration testing
of django-ansible-base components without requiring external PostgreSQL
databases or live service dependencies.
Usage: pytest --ds=awx.main.tests.settings_for_isolated_testing
ISSUE TYPE
COMPONENT NAME
🤖 Generated with Claude Code
Vibe-Coder: Andrew Potozniak [email protected]
Co-Authored-By: Claude [email protected]