-
Notifications
You must be signed in to change notification settings - Fork 35
FEAT: Add multi-threaded stress tests and stress-test-pipeline #410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| Write-Host "Creating database and user for stress tests..." | ||
|
|
||
| # Create database and user | ||
| sqlcmd -S "localhost" -U "sa" -P "$(DB_PASSWORD)" -Q "CREATE DATABASE StressTestDB" -C |
Check notice
Code scanning / devskim
Accessing localhost could indicate debug code, or could hinder scaling. Note
|
|
||
| # Create database and user | ||
| sqlcmd -S "localhost" -U "sa" -P "$(DB_PASSWORD)" -Q "CREATE DATABASE StressTestDB" -C | ||
| sqlcmd -S "localhost" -U "sa" -P "$(DB_PASSWORD)" -Q "CREATE LOGIN testuser WITH PASSWORD = '$(DB_PASSWORD)'" -C |
Check notice
Code scanning / devskim
Accessing localhost could indicate debug code, or could hinder scaling. Note
| # Create database and user | ||
| sqlcmd -S "localhost" -U "sa" -P "$(DB_PASSWORD)" -Q "CREATE DATABASE StressTestDB" -C | ||
| sqlcmd -S "localhost" -U "sa" -P "$(DB_PASSWORD)" -Q "CREATE LOGIN testuser WITH PASSWORD = '$(DB_PASSWORD)'" -C | ||
| sqlcmd -S "localhost" -U "sa" -P "$(DB_PASSWORD)" -d StressTestDB -Q "CREATE USER testuser FOR LOGIN testuser" -C |
Check notice
Code scanning / devskim
Accessing localhost could indicate debug code, or could hinder scaling. Note
| sqlcmd -S "localhost" -U "sa" -P "$(DB_PASSWORD)" -Q "CREATE DATABASE StressTestDB" -C | ||
| sqlcmd -S "localhost" -U "sa" -P "$(DB_PASSWORD)" -Q "CREATE LOGIN testuser WITH PASSWORD = '$(DB_PASSWORD)'" -C | ||
| sqlcmd -S "localhost" -U "sa" -P "$(DB_PASSWORD)" -d StressTestDB -Q "CREATE USER testuser FOR LOGIN testuser" -C | ||
| sqlcmd -S "localhost" -U "sa" -P "$(DB_PASSWORD)" -d StressTestDB -Q "ALTER ROLE db_owner ADD MEMBER testuser" -C |
Check notice
Code scanning / devskim
Accessing localhost could indicate debug code, or could hinder scaling. Note
| sqlcmd -S "localhost" -U "sa" -P "$(DB_PASSWORD)" -d StressTestDB -Q "ALTER ROLE db_owner ADD MEMBER testuser" -C | ||
|
|
||
| # Configure SQL Server for higher connection limits | ||
| sqlcmd -S "localhost" -U "sa" -P "$(DB_PASSWORD)" -Q "EXEC sp_configure 'user connections', 2000; RECONFIGURE;" -C |
Check notice
Code scanning / devskim
Accessing localhost could indicate debug code, or could hinder scaling. Note
| # Create database and user | ||
| sqlcmd -S "localhost" -U "sa" -P "$(DB_PASSWORD)" -Q "CREATE DATABASE StressTestDB" -C -N | ||
| sqlcmd -S "localhost" -U "sa" -P "$(DB_PASSWORD)" -Q "CREATE LOGIN testuser WITH PASSWORD = '$(DB_PASSWORD)'" -C -N | ||
| sqlcmd -S "localhost" -U "sa" -P "$(DB_PASSWORD)" -d StressTestDB -Q "CREATE USER testuser FOR LOGIN testuser" -C -N |
Check notice
Code scanning / devskim
Accessing localhost could indicate debug code, or could hinder scaling. Note
| sqlcmd -S "localhost" -U "sa" -P "$(DB_PASSWORD)" -Q "CREATE DATABASE StressTestDB" -C -N | ||
| sqlcmd -S "localhost" -U "sa" -P "$(DB_PASSWORD)" -Q "CREATE LOGIN testuser WITH PASSWORD = '$(DB_PASSWORD)'" -C -N | ||
| sqlcmd -S "localhost" -U "sa" -P "$(DB_PASSWORD)" -d StressTestDB -Q "CREATE USER testuser FOR LOGIN testuser" -C -N | ||
| sqlcmd -S "localhost" -U "sa" -P "$(DB_PASSWORD)" -d StressTestDB -Q "ALTER ROLE db_owner ADD MEMBER testuser" -C -N |
Check notice
Code scanning / devskim
Accessing localhost could indicate debug code, or could hinder scaling. Note
| sqlcmd -S "localhost" -U "sa" -P "$(DB_PASSWORD)" -d StressTestDB -Q "ALTER ROLE db_owner ADD MEMBER testuser" -C -N | ||
|
|
||
| # Configure SQL Server for higher connection limits | ||
| sqlcmd -S "localhost" -U "sa" -P "$(DB_PASSWORD)" -Q "EXEC sp_configure 'user connections', 2000; RECONFIGURE;" -C -N |
Check notice
Code scanning / devskim
Accessing localhost could indicate debug code, or could hinder scaling. Note
| python -m pytest tests/test_020_multithreaded_stress.py -v -m "stress_threading" --junitxml=stress-test-results-linux.xml --timeout=3600 --capture=tee-sys -x | ||
| displayName: 'Run Multi-Threaded Stress Tests' | ||
| env: | ||
| DB_CONNECTION_STRING: 'Server=localhost;Database=StressTestDB;Uid=testuser;Pwd=$(DB_PASSWORD);TrustServerCertificate=yes' |
Check notice
Code scanning / devskim
Accessing localhost could indicate debug code, or could hinder scaling. Note
| python -m pytest tests/test_011_performance_stress.py -v -m "stress" --junitxml=perf-stress-test-results-linux.xml --timeout=1800 --capture=tee-sys | ||
| displayName: 'Run Performance Stress Tests' | ||
| env: | ||
| DB_CONNECTION_STRING: 'Server=localhost;Database=StressTestDB;Uid=testuser;Pwd=$(DB_PASSWORD);TrustServerCertificate=yes' |
Check notice
Code scanning / devskim
Accessing localhost could indicate debug code, or could hinder scaling. Note
📊 Code Coverage Report
Diff CoverageDiff: main...HEAD, staged and unstaged changesNo lines with coverage information in this diff. 📋 Files Needing Attention📉 Files with overall lowest coverage (click to expand)mssql_python.pybind.logger_bridge.hpp: 58.8%
mssql_python.pybind.logger_bridge.cpp: 59.2%
mssql_python.row.py: 66.2%
mssql_python.helpers.py: 67.5%
mssql_python.pybind.ddbc_bindings.cpp: 69.4%
mssql_python.pybind.ddbc_bindings.h: 69.7%
mssql_python.pybind.connection.connection.cpp: 73.6%
mssql_python.ddbc_bindings.py: 79.6%
mssql_python.pybind.connection.connection_pool.cpp: 79.6%
mssql_python.connection.py: 84.1%🔗 Quick Links
|
Work Item / Issue Reference
Summary
This pull request introduces a dedicated Azure DevOps pipeline for running stress tests on the
mssql-pythondriver, along with updates to test markers inpytest.ini. The new pipeline is designed to run both performance and multi-threaded stress tests on Windows and Linux environments using pre-installed SQL Server 2022, and to publish results for each platform. Thepytest.inichanges clarify and separate stress test markers for easier test selection.Stress Test Pipeline Addition
eng/pipelines/stress-test-pipeline.ymlto automate daily and manual stress testing for themssql-pythondriver on both Windows and Linux, using pre-installed SQL Server 2022 and pre-built wheel artifacts.tests/test_020_multithreaded_stress.py) and original performance stress tests (tests/test_011_performance_stress.py), and publishes JUnit test results for each platform.Test Marker and Default Behavior Updates
pytest.ini:stress_threadingfor multi-threaded stress tests andslowfor slow-running tests, improving test categorization and selection.pytestoptions to exclude bothstressandstress_threadingtests from regular runs, making it easier to run only fast tests by default and providing clear instructions for running specific stress test types.