Skip to content

Commit 71b9bfa

Browse files
committed
Addressed review comments.
1 parent ea003d3 commit 71b9bfa

File tree

3 files changed

+74
-22
lines changed

3 files changed

+74
-22
lines changed

BUILDGUIDE.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,53 @@ Manual Tests require the below setup to run:
5757
|IsManagedInstance | (Optional) When set to `true` **TVP** related tests will use non-Azure bsl files to compare test results. This is needed when testing against Azure Managed Instances; otherwise TVP Tests will fail on TestSet 3. The default value is `false`. |
5858
|PowerShellPath | The full path to PowerShell.exe. This is not required if the path is present in the PATH environment variable. | `D:\\escaped\\absolute\\path\\to\\PowerShell.exe` |
5959

60+
## Test Configuration Environment Variables
61+
62+
Environment variables can be used to override test configuration without modifying `config.json`
63+
files directly. This is useful when running tests via the command line, in CI/CD pipelines,
64+
containerized environments, or when switching between configurations frequently.
65+
66+
### Main Test Suite (`Microsoft.Data.SqlClient.TestUtilities`)
67+
68+
These variables apply to unit, functional, and manual tests. The configuration is defined in
69+
[`Config.cs`](src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/Config.cs).
70+
71+
| Variable | Description | Default |
72+
|----------|-------------|---------|
73+
| `TEST_MDS_CONFIG` | Override the path to the `config.json` file used by the test runner. | `config.json` (in the working directory) |
74+
| `MDS_TCPConnectionString` | Override the TCP connection string. Takes precedence over the value in `config.json`. | Value from `config.json` |
75+
76+
Example:
77+
78+
```bash
79+
export TEST_MDS_CONFIG=~/my-test-config.json
80+
export MDS_TCPConnectionString="Server=myserver;Database=mydb;Trusted_Connection=True;"
81+
dotnet test src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTests.csproj
82+
```
83+
84+
### Performance Tests
85+
86+
These variables apply to performance benchmarks. The configuration is defined in
87+
[`Config.cs`](src/Microsoft.Data.SqlClient/tests/PerformanceTests/Config/Config.cs).
88+
89+
| Variable | Description | Default |
90+
|----------|-------------|---------|
91+
| `RUNNER_CONFIG` | Override the path to the `runnerconfig.json` file used by performance benchmarks. | `runnerconfig.json` (in the DLL output directory) |
92+
93+
See [Run Performance Tests](#run-performance-tests) for more details.
94+
95+
### Azure Extension Tests
96+
97+
These variables apply to the Azure extension test suite. The configuration is defined in
98+
[`Config.cs`](src/Microsoft.Data.SqlClient.Extensions/Azure/test/Config.cs).
99+
100+
| Variable | Description | Default |
101+
|----------|-------------|---------|
102+
| `TEST_MDS_CONFIG` | Override the path to the `config.json` file used by Azure extension tests. | `config.json` |
103+
| `ADO_POOL` | Set to any value to indicate tests are running in an Azure DevOps CI pool. | _(unset)_ |
104+
| `SYSTEM_ACCESSTOKEN` | Azure Pipelines system access token, used for workload identity federation tests. | _(unset)_ |
105+
| `TEST_DEBUG_EMIT` | Set to any value to enable debug output of configuration values during test startup. Sensitive values are Base64-encoded. | _(unset)_ |
106+
60107
## MSBuild Reference
61108

62109
### Targets

src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataReaderTest/DataReaderTest.cs

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ public static async Task<int> CanReadXmlData()
401401
<genre>Computer</genre>
402402
<price>44.95</price>
403403
<publish_date>2000-10-01</publish_date>
404-
<description>An in-depth look at creating applications
404+
<description>An in-depth look at creating applications
405405
with XML.</description>
406406
</book>
407407
<book id=""bk102"">
@@ -410,8 +410,8 @@ with XML.</description>
410410
<genre>Fantasy</genre>
411411
<price>5.95</price>
412412
<publish_date>2000-12-16</publish_date>
413-
<description>A former architect battles corporate zombies,
414-
an evil sorceress, and her own childhood to become queen
413+
<description>A former architect battles corporate zombies,
414+
an evil sorceress, and her own childhood to become queen
415415
of the world.</description>
416416
</book>
417417
<book id=""bk103"">
@@ -420,8 +420,8 @@ of the world.</description>
420420
<genre>Fantasy</genre>
421421
<price>5.95</price>
422422
<publish_date>2000-11-17</publish_date>
423-
<description>After the collapse of a nanotechnology
424-
society in England, the young survivors lay the
423+
<description>After the collapse of a nanotechnology
424+
society in England, the young survivors lay the
425425
foundation for a new society.</description>
426426
</book>
427427
<book id=""bk104"">
@@ -430,9 +430,9 @@ of the world.</description>
430430
<genre>Fantasy</genre>
431431
<price>5.95</price>
432432
<publish_date>2001-03-10</publish_date>
433-
<description>In post-apocalypse England, the mysterious
434-
agent known only as Oberon helps to create a new life
435-
for the inhabitants of London. Sequel to Maeve
433+
<description>In post-apocalypse England, the mysterious
434+
agent known only as Oberon helps to create a new life
435+
for the inhabitants of London. Sequel to Maeve
436436
Ascendant.</description>
437437
</book>
438438
<book id=""bk105"">
@@ -441,8 +441,8 @@ of the world.</description>
441441
<genre>Fantasy</genre>
442442
<price>5.95</price>
443443
<publish_date>2001-09-10</publish_date>
444-
<description>The two daughters of Maeve, half-sisters,
445-
battle one another for control of England. Sequel to
444+
<description>The two daughters of Maeve, half-sisters,
445+
battle one another for control of England. Sequel to
446446
Oberon's Legacy.</description>
447447
</book>
448448
<book id=""bk106"">
@@ -451,7 +451,7 @@ of the world.</description>
451451
<genre>Romance</genre>
452452
<price>4.95</price>
453453
<publish_date>2000-09-02</publish_date>
454-
<description>When Carla meets Paul at an ornithology
454+
<description>When Carla meets Paul at an ornithology
455455
conference, tempers fly as feathers get ruffled.</description>
456456
</book>
457457
<book id=""bk107"">
@@ -460,7 +460,7 @@ of the world.</description>
460460
<genre>Romance</genre>
461461
<price>4.95</price>
462462
<publish_date>2000-11-02</publish_date>
463-
<description>A deep sea diver finds true love twenty
463+
<description>A deep sea diver finds true love twenty
464464
thousand leagues beneath the sea.</description>
465465
</book>
466466
<book id=""bk108"">
@@ -479,7 +479,7 @@ thousand leagues beneath the sea.</description>
479479
<price>6.95</price>
480480
<publish_date>2000-11-02</publish_date>
481481
<description>After an inadvertant trip through a Heisenberg
482-
Uncertainty Device, James Salway discovers the problems
482+
Uncertainty Device, James Salway discovers the problems
483483
of being quantum.</description>
484484
</book>
485485
<book id=""bk110"">
@@ -488,7 +488,7 @@ of being quantum.</description>
488488
<genre>Computer</genre>
489489
<price>36.95</price>
490490
<publish_date>2000-12-09</publish_date>
491-
<description>Microsoft's .NET initiative is explored in
491+
<description>Microsoft's .NET initiative is explored in
492492
detail in this deep programmer's reference.</description>
493493
</book>
494494
<book id=""bk111"">
@@ -497,8 +497,8 @@ detail in this deep programmer's reference.</description>
497497
<genre>Computer</genre>
498498
<price>36.95</price>
499499
<publish_date>2000-12-01</publish_date>
500-
<description>The Microsoft MSXML3 parser is covered in
501-
detail, with attention to XML DOM interfaces, XSLT processing,
500+
<description>The Microsoft MSXML3 parser is covered in
501+
detail, with attention to XML DOM interfaces, XSLT processing,
502502
SAX and more.</description>
503503
</book>
504504
<book id=""bk112"">
@@ -508,8 +508,8 @@ SAX and more.</description>
508508
<price>49.95</price>
509509
<publish_date>2001-04-16</publish_date>
510510
<description>Microsoft Visual Studio 7 is explored in depth,
511-
looking at how Visual Basic, Visual C++, C#, and ASP+ are
512-
integrated into a comprehensive development
511+
looking at how Visual Basic, Visual C++, C#, and ASP+ are
512+
integrated into a comprehensive development
513513
environment.</description>
514514
</book>
515515
</catalog>";
@@ -831,13 +831,13 @@ StringName varchar(255) not null,
831831
cmd.CommandText = $""""
832832
SELECT
833833
[gs].[List],
834-
[gs].[UseProtoSerializer]
834+
[gs].[UseProtoSerializer]
835835
FROM
836836
[{tableName}] [gs]
837837
WHERE
838838
([gs].[IsGlobal] = 1 OR [gs].[User_ID] = '{"80004Q4WZ1350KO8NT59RM"}') AND
839839
([gs].[ModuleNameForUse] IS NULL OR [gs].[ModuleNameForUse] = {2})
840-
840+
841841
"""";
842842

843843
var l = (string)await cmd.ExecuteScalarAsync();
@@ -905,6 +905,11 @@ public _Row(int id, Guid documentIdentificationId, string name, string value)
905905
}
906906
}
907907

908+
// NOTE: This test is very slow (can exceed 10 minutes on macOS). It runs 512 iterations
909+
// (packet sizes 512..2045 stepping by 3), each opening a new non-pooled TCP connection and
910+
// reading 21 rows that include several nvarchar(max) values tens-of-thousands of characters
911+
// long. With small packet sizes the large strings require many network round-trips, and on
912+
// non-Windows platforms the managed SNI layer is used which adds further overhead.
908913
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
909914
public static async Task CanReadAwkwardDataLengths()
910915
{
@@ -1038,7 +1043,7 @@ [Value] [nvarchar](max) NULL
10381043
SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(DataTestUtility.TCPConnectionString);
10391044
builder.PersistSecurityInfo = true;
10401045
builder.Pooling = false;
1041-
1046+
10421047
for (int packetSize = 512; packetSize<2048; packetSize+=3)
10431048
{
10441049
builder.PacketSize = packetSize;

src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/Config.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public class Config
4646
public static Config Load(string configPath = @"config.json")
4747
{
4848
// Allow an override of the config path via an environment variable.
49-
configPath = Environment.GetEnvironmentVariable("MDS_TEST_CONFIG") ?? configPath;
49+
configPath = Environment.GetEnvironmentVariable("TEST_MDS_CONFIG") ?? configPath;
5050

5151
Config config;
5252
try

0 commit comments

Comments
 (0)