django-concurrent-test 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- django_concurrent_test-1.0.0/AUTHORS.md +35 -0
- django_concurrent_test-1.0.0/CHANGELOG.md +208 -0
- django_concurrent_test-1.0.0/LICENSE +21 -0
- django_concurrent_test-1.0.0/MANIFEST.in +8 -0
- django_concurrent_test-1.0.0/PKG-INFO +554 -0
- django_concurrent_test-1.0.0/README.md +491 -0
- django_concurrent_test-1.0.0/django_concurrent_test/__init__.py +23 -0
- django_concurrent_test-1.0.0/django_concurrent_test/db.py +1309 -0
- django_concurrent_test-1.0.0/django_concurrent_test/exceptions.py +43 -0
- django_concurrent_test-1.0.0/django_concurrent_test/middleware.py +487 -0
- django_concurrent_test-1.0.0/django_concurrent_test/pytest_plugin.py +319 -0
- django_concurrent_test-1.0.0/django_concurrent_test/runner.py +1325 -0
- django_concurrent_test-1.0.0/django_concurrent_test/security.py +321 -0
- django_concurrent_test-1.0.0/django_concurrent_test/timing_utils.py +316 -0
- django_concurrent_test-1.0.0/django_concurrent_test.egg-info/PKG-INFO +554 -0
- django_concurrent_test-1.0.0/django_concurrent_test.egg-info/SOURCES.txt +36 -0
- django_concurrent_test-1.0.0/django_concurrent_test.egg-info/dependency_links.txt +1 -0
- django_concurrent_test-1.0.0/django_concurrent_test.egg-info/entry_points.txt +2 -0
- django_concurrent_test-1.0.0/django_concurrent_test.egg-info/not-zip-safe +1 -0
- django_concurrent_test-1.0.0/django_concurrent_test.egg-info/requires.txt +31 -0
- django_concurrent_test-1.0.0/django_concurrent_test.egg-info/top_level.txt +1 -0
- django_concurrent_test-1.0.0/pyproject.toml +161 -0
- django_concurrent_test-1.0.0/requirements-dev.txt +10 -0
- django_concurrent_test-1.0.0/requirements.txt +6 -0
- django_concurrent_test-1.0.0/setup.cfg +4 -0
- django_concurrent_test-1.0.0/setup.py +68 -0
- django_concurrent_test-1.0.0/tests/__init__.py +3 -0
- django_concurrent_test-1.0.0/tests/conftest.py +291 -0
- django_concurrent_test-1.0.0/tests/test_additional_improvements.py +576 -0
- django_concurrent_test-1.0.0/tests/test_database.py +470 -0
- django_concurrent_test-1.0.0/tests/test_database_optimizations.py +520 -0
- django_concurrent_test-1.0.0/tests/test_drf_integration.py +266 -0
- django_concurrent_test-1.0.0/tests/test_enhanced_runner.py +739 -0
- django_concurrent_test-1.0.0/tests/test_improvements.py +501 -0
- django_concurrent_test-1.0.0/tests/test_middleware_improvements.py +479 -0
- django_concurrent_test-1.0.0/tests/test_potential_improvements.py +535 -0
- django_concurrent_test-1.0.0/tests/test_runner.py +475 -0
- django_concurrent_test-1.0.0/tests/test_security.py +328 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Authors
|
|
2
|
+
|
|
3
|
+
## Primary Author
|
|
4
|
+
|
|
5
|
+
**Rana Ehtasham Ali**
|
|
6
|
+
- **Email**: ranaehtashamali1@gmail.com
|
|
7
|
+
- **Phone**: +923224712517
|
|
8
|
+
- **GitHub**: [@RanaEhtashamAli](https://github.com/RanaEhtashamAli)
|
|
9
|
+
|
|
10
|
+
## Project Information
|
|
11
|
+
|
|
12
|
+
**django-concurrent-test** is a production-ready Django package for safe and configurable concurrent testing with isolated databases, timing analytics, and concurrency simulation middleware.
|
|
13
|
+
|
|
14
|
+
- **Repository**: https://github.com/RanaEhtashamAli/django-concurrent-test
|
|
15
|
+
- **Documentation**: https://django-concurrent-test.readthedocs.io/
|
|
16
|
+
- **PyPI**: https://pypi.org/project/django-concurrent-test/
|
|
17
|
+
|
|
18
|
+
## Contributing
|
|
19
|
+
|
|
20
|
+
We welcome contributions from the community! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details on how to submit pull requests, report issues, and contribute to the project.
|
|
21
|
+
|
|
22
|
+
## License
|
|
23
|
+
|
|
24
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
25
|
+
|
|
26
|
+
## Acknowledgments
|
|
27
|
+
|
|
28
|
+
- Django team for the excellent testing framework
|
|
29
|
+
- PostgreSQL and MySQL communities for database support
|
|
30
|
+
- All contributors who have helped improve this package
|
|
31
|
+
- The open source community for inspiration and feedback
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
**Made with โค๏ธ for the Django community**
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [1.0.0] - 2024-01-XX
|
|
9
|
+
|
|
10
|
+
### ๐ First Production Release
|
|
11
|
+
|
|
12
|
+
This release includes full concurrent testing support for Django, including middleware-based state mutation detection, request simulation, isolated DB cloning, and test timing analytics.
|
|
13
|
+
|
|
14
|
+
### โจ Added
|
|
15
|
+
|
|
16
|
+
#### Core Features
|
|
17
|
+
- **Concurrent Test Runner**: Production-grade concurrent test execution with ThreadPoolExecutor
|
|
18
|
+
- **Secure Database Templating**: Zero-config parallel testing with isolated database instances
|
|
19
|
+
- **Dynamic Worker Scaling**: CPU and memory-aware worker count calculation
|
|
20
|
+
- **Connection Pooling**: Efficient database connection management with health checks
|
|
21
|
+
- **Template Database Caching**: Cached database templates for faster setup
|
|
22
|
+
- **Batch Database Operations**: Batch cloning and cleanup for improved performance
|
|
23
|
+
|
|
24
|
+
#### Middleware System
|
|
25
|
+
- **ConcurrentSafetyMiddleware**: Detects race conditions, session modifications, and slow requests
|
|
26
|
+
- **StateMutationMiddleware**: Tracks global state changes and settings modifications
|
|
27
|
+
- **ConcurrencySimulationMiddleware**: Simulates concurrent conditions with controlled delays
|
|
28
|
+
- **Runtime Configuration**: Dynamic middleware behavior adjustment via test overrides
|
|
29
|
+
- **Auto-Registration**: Optional middleware auto-registration for pytest sessions
|
|
30
|
+
|
|
31
|
+
#### Testing Tools
|
|
32
|
+
- **assert_concurrent_safety()**: Validates functions for concurrent execution safety
|
|
33
|
+
- **simulate_concurrent_requests()**: Simulates concurrent request scenarios
|
|
34
|
+
- **concurrent_test_context()**: Context manager for concurrent testing environment
|
|
35
|
+
- **Test Timeout Management**: Signal-based timeout handling with custom exceptions
|
|
36
|
+
- **Database Isolation Verification**: Ensures proper database isolation between workers
|
|
37
|
+
|
|
38
|
+
#### Timing Analytics
|
|
39
|
+
- **Comprehensive Timing Tools**: Load, save, filter, merge, and analyze test timings
|
|
40
|
+
- **CSV Import/Export**: Import and export timing data in CSV format
|
|
41
|
+
- **Benchmark JSON Output**: Detailed test statistics and performance metrics
|
|
42
|
+
- **Performance Monitoring**: Connection pool statistics and resource monitoring
|
|
43
|
+
- **Memory-Based Scaling**: Automatic worker scaling based on available memory
|
|
44
|
+
|
|
45
|
+
#### Security Features
|
|
46
|
+
- **Environment Validation**: Comprehensive security checks and environment validation
|
|
47
|
+
- **Resource Monitoring**: System resource checking and safe worker count calculation
|
|
48
|
+
- **File Permission Validation**: Security validation for file permissions
|
|
49
|
+
- **Log Sanitization**: Automatic removal of sensitive information from logs
|
|
50
|
+
- **Telemetry-Free Design**: Zero data collection or external dependencies
|
|
51
|
+
|
|
52
|
+
#### Pytest Integration
|
|
53
|
+
- **Pytest Plugin**: Full pytest integration with concurrent test execution
|
|
54
|
+
- **CLI Options**: Rich command-line interface with timing import/export
|
|
55
|
+
- **Timeout Hierarchy**: Separate timeouts for tests, workers, and global execution
|
|
56
|
+
- **Structured Logging**: Configurable logging with [CONCURRENT] prefix
|
|
57
|
+
- **Benchmark Reporting**: Comprehensive benchmark reports with detailed statistics
|
|
58
|
+
|
|
59
|
+
#### Database Support
|
|
60
|
+
- **PostgreSQL Cloning**: Template-based database cloning with TEMPLATE template0
|
|
61
|
+
- **MySQL Cloning**: Schema replication with IGNORE DATA clause
|
|
62
|
+
- **SQLite Support**: Local development support with sequential fallback
|
|
63
|
+
- **Connection Recycling**: Automatic connection health checks and recycling
|
|
64
|
+
- **Database Vendor Abstraction**: Unified interface for different database backends
|
|
65
|
+
|
|
66
|
+
#### DRF Integration
|
|
67
|
+
- **Optional DRF Support**: Django REST Framework compatibility
|
|
68
|
+
- **Viewset Testing**: Concurrent testing for DRF viewsets
|
|
69
|
+
- **Serializer Testing**: Concurrent validation testing for DRF serializers
|
|
70
|
+
- **Authentication Testing**: Concurrent testing for DRF authentication classes
|
|
71
|
+
- **API Endpoint Testing**: Comprehensive API endpoint concurrency testing
|
|
72
|
+
|
|
73
|
+
#### Error Handling
|
|
74
|
+
- **Custom Exceptions**: Comprehensive exception hierarchy for different error types
|
|
75
|
+
- **Graceful Fallbacks**: Automatic degradation to sequential testing when needed
|
|
76
|
+
- **Timeout Management**: Signal-based timeout handling with proper cleanup
|
|
77
|
+
- **Database Error Recovery**: Automatic database connection recovery
|
|
78
|
+
- **Resource Cleanup**: Proper cleanup of resources and connections
|
|
79
|
+
|
|
80
|
+
### ๐ง Changed
|
|
81
|
+
|
|
82
|
+
- **Logging System**: Replaced print() statements with structured logging using `__name__`
|
|
83
|
+
- **Type Hints**: Added comprehensive type hints throughout the codebase
|
|
84
|
+
- **Documentation**: Enhanced docstrings and documentation for all public APIs
|
|
85
|
+
- **Error Messages**: Improved error messages with actionable information
|
|
86
|
+
- **Performance**: Optimized database operations and connection management
|
|
87
|
+
|
|
88
|
+
### ๐ Fixed
|
|
89
|
+
|
|
90
|
+
- **PostgreSQL Cloning**: Fixed template database cloning to use TEMPLATE template0
|
|
91
|
+
- **MySQL Cloning**: Fixed database cloning with proper IGNORE DATA clause
|
|
92
|
+
- **Thread Safety**: Improved thread-safe connection handling and template caching
|
|
93
|
+
- **Memory Measurement**: Added fallback logging for memory measurement failures
|
|
94
|
+
- **DEBUG Validation**: Fixed DEBUG validation to warn instead of fail
|
|
95
|
+
- **Function Naming**: Fixed duplicate function names in timing utilities
|
|
96
|
+
|
|
97
|
+
### ๐ Security
|
|
98
|
+
|
|
99
|
+
- **Environment Variables**: Centralized environment variable parsing with type safety
|
|
100
|
+
- **Database Names**: Project-specific template database naming for security
|
|
101
|
+
- **Permission Validation**: Enhanced database permission validation
|
|
102
|
+
- **Resource Limits**: Improved resource limit enforcement and validation
|
|
103
|
+
- **Input Sanitization**: Enhanced input validation and sanitization
|
|
104
|
+
|
|
105
|
+
### ๐ Documentation
|
|
106
|
+
|
|
107
|
+
- **Comprehensive README**: Complete documentation with usage examples
|
|
108
|
+
- **API Documentation**: Detailed API documentation for all public functions
|
|
109
|
+
- **Security Guide**: Security considerations and best practices
|
|
110
|
+
- **Performance Guide**: Performance optimization and monitoring guide
|
|
111
|
+
- **Migration Guide**: Guide for upgrading from previous versions
|
|
112
|
+
|
|
113
|
+
### ๐งช Testing
|
|
114
|
+
|
|
115
|
+
- **Comprehensive Test Suite**: Extensive test coverage for all features
|
|
116
|
+
- **Integration Tests**: Integration tests for Django and DRF compatibility
|
|
117
|
+
- **Performance Tests**: Performance benchmarking and regression tests
|
|
118
|
+
- **Security Tests**: Security validation and penetration tests
|
|
119
|
+
- **Concurrency Tests**: Concurrent execution safety tests
|
|
120
|
+
|
|
121
|
+
### ๐ฆ Packaging
|
|
122
|
+
|
|
123
|
+
- **Modern Packaging**: Updated to use pyproject.toml for modern Python packaging
|
|
124
|
+
- **Dependency Management**: Proper dependency specification and version constraints
|
|
125
|
+
- **Build System**: Automated build and release process
|
|
126
|
+
- **CI/CD Integration**: GitHub Actions workflow for automated testing
|
|
127
|
+
- **Distribution**: PyPI distribution with proper metadata
|
|
128
|
+
|
|
129
|
+
### ๐ Performance
|
|
130
|
+
|
|
131
|
+
- **Database Operations**: 2-4x faster database setup and teardown
|
|
132
|
+
- **Test Execution**: 1.5-3x faster test execution for I/O-bound tests
|
|
133
|
+
- **Memory Usage**: Optimized memory usage with connection pooling
|
|
134
|
+
- **CPU Utilization**: Improved CPU utilization with dynamic scaling
|
|
135
|
+
- **Resource Management**: Efficient resource management and cleanup
|
|
136
|
+
|
|
137
|
+
### ๐ง Developer Experience
|
|
138
|
+
|
|
139
|
+
- **IDE Support**: Enhanced IDE support with comprehensive type hints
|
|
140
|
+
- **Debugging**: Improved debugging capabilities with structured logging
|
|
141
|
+
- **Error Reporting**: Better error reporting and troubleshooting information
|
|
142
|
+
- **Configuration**: Simplified configuration and setup process
|
|
143
|
+
- **Examples**: Comprehensive examples and usage patterns
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## [0.9.0] - 2024-01-XX
|
|
148
|
+
|
|
149
|
+
### Beta Release
|
|
150
|
+
|
|
151
|
+
- Initial beta release with core concurrent testing functionality
|
|
152
|
+
- Basic database templating support
|
|
153
|
+
- Simple test runner implementation
|
|
154
|
+
- Preliminary security features
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## [0.8.0] - 2024-01-XX
|
|
159
|
+
|
|
160
|
+
### Alpha Release
|
|
161
|
+
|
|
162
|
+
- Proof of concept implementation
|
|
163
|
+
- Basic concurrent test execution
|
|
164
|
+
- Initial database cloning support
|
|
165
|
+
- Core architecture design
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## [0.1.0] - 2024-01-XX
|
|
170
|
+
|
|
171
|
+
### Initial Release
|
|
172
|
+
|
|
173
|
+
- Project initialization
|
|
174
|
+
- Basic project structure
|
|
175
|
+
- Core concept development
|
|
176
|
+
- Initial documentation
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Unreleased
|
|
181
|
+
|
|
182
|
+
### Planned Features
|
|
183
|
+
|
|
184
|
+
- **Async Support**: Full asyncio support for async test execution
|
|
185
|
+
- **Distributed Testing**: Support for distributed test execution across multiple machines
|
|
186
|
+
- **Advanced Metrics**: Advanced performance metrics and analytics
|
|
187
|
+
- **Plugin System**: Extensible plugin system for custom functionality
|
|
188
|
+
- **Cloud Integration**: Cloud provider integration for scalable testing
|
|
189
|
+
|
|
190
|
+
### Known Issues
|
|
191
|
+
|
|
192
|
+
- None currently known
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Contributing
|
|
197
|
+
|
|
198
|
+
Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.
|
|
199
|
+
|
|
200
|
+
## Contact
|
|
201
|
+
|
|
202
|
+
- **Email**: ranaehtashamali1@gmail.com
|
|
203
|
+
- **Phone**: +923224712517
|
|
204
|
+
- **GitHub**: [@RanaEhtashamAli](https://github.com/RanaEhtashamAli)
|
|
205
|
+
|
|
206
|
+
## License
|
|
207
|
+
|
|
208
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Django Concurrent Test Team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|