|
2 | 2 |
|
3 | 3 | This Stress testing application for `Microsoft.Data.SqlClient` is under progress. |
4 | 4 | This project intends to help finding a certain level of effectiveness under unfavorable conditions, and verifying the mode of failures. |
5 | | -This is a console application with targeting frameworks `.Net Framework 4.8`, `.NET 9.0` under driver's supported operating systems and SQL Servers. |
| 5 | +This is a console application with targeting frameworks `.Net Framework 4.8.1`, `.NET 9.0` under driver's supported operating systems and SQL Servers. |
6 | 6 |
|
7 | 7 | ## Purpose of application for developers |
8 | 8 |
|
9 | 9 | Define fuzz tests for all new features/APIs in the driver and to be run before every GA release. |
10 | 10 |
|
11 | | -# Pre-Requisites |
| 11 | +## Pre-Requisites |
12 | 12 |
|
13 | | -required in StressTest.config: |
| 13 | +Required in StressTest.config: |
14 | 14 |
|
15 | | -"name": stress testing source configuration name. |
16 | | -"type": only `SqlServer` is acceptable. |
17 | | -"isDefault": If there is a source node with `isDefault=true`, this node is returned. |
18 | | -"dataSource": SQL Server data source name. |
19 | | -"database": targeting database name in the SQL Server. |
20 | | -"user": user Id to connect the server. |
21 | | -"password": paired password with the user. |
22 | | -"supportsWindowsAuthentication": tries to use integrated security in connection string mixed with SQL Server authentication if it set to `true` by applying the randomization. |
23 | | -"isLocal": `true` means database is local. |
24 | | -"disableMultiSubnetFailover": tries to add Multi-subnet Failover fake host entries when it equals `true`, |
25 | | -"disableNamedPipes": `true` means the connections will create just using tcp protocol. |
26 | | -"encrypt": assigns the encrypt property of the connection strings. |
| 15 | +|Field|Values|Description| |
| 16 | +|-|-|-| |
| 17 | +|`name`||Stress testing source configuration name.| |
| 18 | +|`type`|`SqlServer`|Only `SqlServer` is acceptable.| |
| 19 | +|`isDefault`|`true`, `false`|If there is a source node with `isDefault=true`, this node is returned.| |
| 20 | +|`dataSource`||SQL Server data source name.| |
| 21 | +|`database`||Targeting database name in the SQL Server.| |
| 22 | +|`user`||User Id to connect the server.| |
| 23 | +|`password`||Paired password with the user.| |
| 24 | +|`supportsWindowsAuthentication`|`true`, `false`|Tries to use integrated security in connection string mixed with SQL Server authentication if it set to `true` by applying the randomization.| |
| 25 | +|`isLocal`|`true`, `false`|`true` means database is local.| |
| 26 | +|`disableMultiSubnetFailover`|`true`, `false`|Tries to add Multi-subnet Failover fake host entries when it equals `true`.| |
| 27 | +|`disableNamedPipes`|`true`, `false`|`true` means the connections will create just using tcp protocol.| |
| 28 | +|`encrypt`|`true`, `false`|Assigns the encrypt property of the connection strings.| |
27 | 29 |
|
28 | | -# Adding new Tests |
29 | | -- [ToDO] |
| 30 | +## Adding new Tests |
30 | 31 |
|
31 | | -# Building the application |
| 32 | +- [ToDo] |
32 | 33 |
|
33 | | -To build the application we need to run the command: 'dotnet build <-f|--framework <FRAMEWORK>> [-c|--configuration <Release|Debug>]' |
34 | | -The path should be pointing to SqlClient.Stress.Runner.csproj file. |
| 34 | +## Building the application |
| 35 | + |
| 36 | +To build the application we need to run the command: |
35 | 37 |
|
36 | 38 | ```bash |
37 | | -# Default Build Configuration: |
| 39 | +dotnet build <-f|--framework <FRAMEWORK>> [-c|--configuration <Release|Debug>] |
| 40 | +``` |
38 | 41 |
|
39 | | -> dotnet build |
| 42 | +The path should be pointing to SqlClient.Stress.Runner.csproj file. |
| 43 | + |
| 44 | +```bash |
40 | 45 | # Builds the application for the Client Os in `Debug` Configuration for `AnyCpu` platform. |
41 | 46 | # All supported target frameworks, .NET Framework (NetFx) and .NET Core drivers are built by default (as supported by Client OS). |
| 47 | + |
| 48 | +> dotnet build |
42 | 49 | ``` |
43 | 50 |
|
44 | 51 | ```bash |
45 | | -> dotnet build -f netcoreapp3.1 |
46 | | -# Build the application for .Net core 3.1 with `Debug` configuration. |
| 52 | +# Build the application for .Net framework 4.8.1 with `Debug` configuration. |
47 | 53 |
|
48 | | -> dotnet build -f net48 |
49 | | -# Build the application for .Net framework 4.8 with `Debug` configuration. |
| 54 | +> dotnet build -f net481 |
50 | 55 | ``` |
51 | 56 |
|
52 | 57 | ```bash |
53 | | -> dotnet build -f net5.0 -c Release |
54 | | -# Build the application for .Net 5.0 with `Release` configuration. |
| 58 | +# Build the application for .Net 9.0 with `Release` configuration. |
55 | 59 |
|
56 | | -> dotnet build -f net48 -c Release |
57 | | -# Build the application for .Net framework 4.8 with `Release` configuration. |
| 60 | +> dotnet build -f net9.0 -c Release |
58 | 61 | ``` |
59 | 62 |
|
60 | 63 | ```bash |
61 | | -> dotnet clean |
62 | 64 | # Cleans all build directories |
| 65 | + |
| 66 | +> dotnet clean |
63 | 67 | ``` |
64 | 68 |
|
65 | | -# Running tests |
| 69 | +## Running tests |
66 | 70 |
|
67 | 71 | After building the application, find the built folder with target framework and run the `stresstest.exe` file with required arguments. |
68 | 72 | Find the result in a log file inside the `logs` folder besides the command prompt. |
69 | 73 |
|
70 | 74 | ## Command prompt |
71 | 75 |
|
72 | | -```bash |
73 | | -> stresstest.exe [-a <module name>] <arguments> |
74 | | - |
75 | | --a <module name> should specify path to the assembly containing the tests. |
76 | | -``` |
77 | | - |
78 | | -## Supported arguments |
79 | | - |
80 | | --all Run all tests - best for debugging, not perf measurements. |
| 76 | +You must run the stress tests from the root of the Stress Tests project |
| 77 | +directory (i.e. the same directory this readme file is in). |
81 | 78 |
|
82 | | --verify Run in functional verification mode. [not implemented] |
83 | | - |
84 | | --duration <n> Duration of the test in seconds. Default value is 1 second. |
85 | | - |
86 | | --threads <n> Number of threads to use. Default value is 16. |
87 | | - |
88 | | --override <name> <value> Override the value of a test property. |
89 | | - |
90 | | --test <name1;name2> Run specific test(s). |
| 79 | +```bash |
| 80 | +# Linux |
| 81 | +$ cd /home/paul/dev/SqlClient/src/Microsoft.Data.SqlClient/tests/StressTests |
91 | 82 |
|
92 | | --debug Print process ID in the beginning and wait for Enter (to give your time to attach the debugger). |
| 83 | +# Via dotnet run CLI: |
| 84 | +$ dotnet run -no-build -f net9.0 --project SqlClient.Stress.Runner/SqlClient.Stress.Runner.csproj -- -a SqlClient.Stress.Tests |
93 | 85 |
|
94 | | --exceptionThreshold <n> An optional limit on exceptions which will be caught. When reached, test will halt. |
| 86 | +# Via dotnet CLI: |
| 87 | +$ dotnet SqlClient.Stress.Runner/bin/Debug/net9.0/stresstest.dll -a SqlClient.Stress.Tests |
| 88 | +``` |
95 | 89 |
|
96 | | --monitorenabled True or False to enable monitoring. Default is false [not implemented] |
| 90 | +```powershell |
| 91 | +# Windows |
| 92 | +> cd \dev\SqlClient\src\Microsoft.Data.SqlClient\tests\StressTests |
97 | 93 |
|
98 | | --randomSeed Enables setting of the random number generator used internally. This serves both the purpose |
99 | | - of helping to improve reproducibility and making it deterministic from Chess's perspective |
100 | | - for a given schedule. Default is 0. |
| 94 | +# Via dotnet run CLI: |
| 95 | +$ dotnet run -no-build -f net9.0 --project SqlClient.Stress.Runner\SqlClient.Stress.Runner.csproj -- -a SqlClient.Stress.Tests |
101 | 96 |
|
102 | | --filter Run tests whose stress test attributes match the given filter. Filter is not applied if attribute |
103 | | - does not implement ITestAttributeFilter. Example: -filter TestType=Query,Update;IsServerTest=True |
| 97 | +# Via executable: |
| 98 | +> .\SqlClient.Stress.Runner\bin\Debug\net481\stresstest.exe -a SqlClient.Stress.Tests |
| 99 | +``` |
104 | 100 |
|
105 | | --printMethodName Print tests' title in console window |
| 101 | +## Supported arguments |
106 | 102 |
|
107 | | --deadlockdetection True or False to enable deadlock detection. Default is `false`. |
| 103 | +|Argument|Values|Description| |
| 104 | +|-|-|-| |
| 105 | +|-all||Run all tests - best for debugging, not perf measurements.| |
| 106 | +|-verify||Run in functional verification mode. [not implemented]| |
| 107 | +|-duration|<n>|Duration of the test in seconds. Default value is 1 second.| |
| 108 | +|-threads|<n>|Number of threads to use. Default value is 16.| |
| 109 | +|-override|<name> <value>|Override the value of a test property.| |
| 110 | +|-test|<name1;name2>|Run specific test(s).| |
| 111 | +|-debug||Print process ID in the beginning and wait for Enter (to give your time to attach the debugger).| |
| 112 | +|-exceptionThreshold|<n>|An optional limit on exceptions which will be caught. When reached, test will halt.| |
| 113 | +|-monitorenabled|true, false|True or False to enable monitoring. Default is false [not implemented]| |
| 114 | +|-randomSeed||Enables setting of the random number generator used internally. This serves both the purpose of helping to improve reproducibility and making it deterministic from Chess's perspective for a given schedule. Default is 0.| |
| 115 | +|-filter|<filter>|Run tests whose stress test attributes match the given filter. Filter is not applied if attribute does not implement ITestAttributeFilter. Example: -filter TestType=Query,Update;IsServerTest=True| |
| 116 | +|-printMethodName||Print tests' title in console window| |
| 117 | +|-deadlockdetection|true, false|True or False to enable deadlock detection. Default is `false`.| |
108 | 118 |
|
109 | 119 | ```bash |
110 | | -> stresstest.exe -a SqlClient.Stress.Tests -all |
111 | 120 | # Run the application for a built target framework and all discovered tests without debugger attached. |
| 121 | + |
| 122 | +> .\stresstest.exe -a SqlClient.Stress.Tests -all |
112 | 123 | ``` |
113 | 124 |
|
114 | 125 | ```bash |
115 | | -> stresstest.exe -a SqlClient.Stress.Tests -all -printMethodName |
116 | 126 | # Run the application for a built target framework and all discovered tests without debugger attached and shows the test methods' names. |
| 127 | + |
| 128 | +> .\stresstest.exe -a SqlClient.Stress.Tests -all -printMethodName |
117 | 129 | ``` |
118 | 130 |
|
119 | 131 | ```bash |
120 | | -> stresstest.exe -a SqlClient.Stress.Tests -all -debug |
121 | 132 | # Run the application for a built target framework and all discovered tests and will wait for debugger to be attached. |
| 133 | + |
| 134 | +> .\stresstest.exe -a SqlClient.Stress.Tests -all -debug |
122 | 135 | ``` |
123 | 136 |
|
124 | 137 | ```bash |
125 | | -> stresstest.exe -a SqlClient.Stress.Tests -test TestExecuteXmlReaderAsyncCancellation |
126 | 138 | # Run the application for a built target framework and "TestExecuteXmlReaderAsyncCancellation" test without debugger attached. |
| 139 | + |
| 140 | +> .\stresstest.exe -a SqlClient.Stress.Tests -test TestExecuteXmlReaderAsyncCancellation |
127 | 141 | ``` |
128 | 142 |
|
129 | 143 | ```bash |
130 | | -> stresstest.exe -a SqlClient.Stress.Tests -test TestExecuteXmlReaderAsyncCancellation |
131 | 144 | # Run the application for a built target framework and "TestExecuteXmlReaderAsyncCancellation" test without debugger attached. |
| 145 | + |
| 146 | +> .\stresstest.exe -a SqlClient.Stress.Tests -test TestExecuteXmlReaderAsyncCancellation |
132 | 147 | ``` |
133 | 148 |
|
134 | 149 | ```bash |
135 | | -> stresstest.exe -a SqlClient.Stress.Tests -all -duration 10 |
136 | 150 | # Run the application for a built target framework and all discovered tests without debugger attached for 10 seconds. |
| 151 | + |
| 152 | +> .\stresstest.exe -a SqlClient.Stress.Tests -all -duration 10 |
137 | 153 | ``` |
138 | 154 |
|
139 | 155 | ```bash |
140 | | -> stresstest.exe -a SqlClient.Stress.Tests -all -threads 5 |
141 | 156 | # Run the application for a built target framework and all discovered tests without debugger attached with 5 threads. |
| 157 | + |
| 158 | +> .\stresstest.exe -a SqlClient.Stress.Tests -all -threads 5 |
142 | 159 | ``` |
143 | 160 |
|
144 | 161 | ```bash |
145 | | -> stresstest.exe -a SqlClient.Stress.Tests -all -deadlockdetection true |
146 | 162 | # Run the application for a built target framework and all discovered tests without debugger attached and dead lock detection process. |
| 163 | + |
| 164 | +> .\stresstest.exe -a SqlClient.Stress.Tests -all -deadlockdetection true |
147 | 165 | ``` |
148 | 166 |
|
149 | 167 | ```bash |
150 | | -> stresstest.exe -a SqlClient.Stress.Tests -all -override Weight 15 |
151 | 168 | # Run the application for a built target framework and all discovered tests without debugger attached with overriding the weight property with value 15. |
| 169 | + |
| 170 | +> .\stresstest.exe -a SqlClient.Stress.Tests -all -override Weight 15 |
152 | 171 | ``` |
153 | 172 |
|
154 | 173 | ```bash |
155 | | -> stresstest.exe -a SqlClient.Stress.Tests -all -randomSeed 5 |
156 | 174 | # Run the application for a built target framework and all discovered tests without debugger attached with injecting random seed of 5. |
| 175 | + |
| 176 | +> .\stresstest.exe -a SqlClient.Stress.Tests -all -randomSeed 5 |
157 | 177 | ``` |
158 | 178 |
|
159 | | -# Further thoughts |
| 179 | +## Further thoughts |
160 | 180 |
|
161 | 181 | - Implement the uncompleted arguments. |
162 | | -- Add support `dotnet run` command. |
163 | 182 | - Add more tests. |
164 | 183 | - Add support running tests with **System.Data.SqlClient** too. |
0 commit comments