Skip to content

Commit 87b5435

Browse files
authored
Tests | Split MultipleResultsTest, clean up console logging (#3060)
* Split MultipleResultsTest, clean up console logging * Further console logging disabled based on CI results. Also adjusted certificate generation, it's redirecting standard errors and not always loading the user profile. * Disabling TDSServer debug logging in one diagnostic test * Remove CustomDeviceFlowCallback * Early response to code review * Checked use of Environment.NewLine * Separated Assert.Throws call
1 parent 42a1999 commit 87b5435

File tree

13 files changed

+147
-427
lines changed

13 files changed

+147
-427
lines changed

src/Microsoft.Data.SqlClient/tests/FunctionalTests/AADAuthenticationTests.cs

+2-8
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ private void InvalidCombinationCheck(SqlCredential credential)
5353
[Fact]
5454
public void CustomActiveDirectoryProviderTest()
5555
{
56-
SqlAuthenticationProvider authProvider = new ActiveDirectoryAuthenticationProvider(CustomDeviceFlowCallback);
56+
SqlAuthenticationProvider authProvider = new ActiveDirectoryAuthenticationProvider(static (result) => Task.CompletedTask);
5757
SqlAuthenticationProvider.SetProvider(SqlAuthenticationMethod.ActiveDirectoryDeviceCodeFlow, authProvider);
5858
Assert.Equal(authProvider, SqlAuthenticationProvider.GetProvider(SqlAuthenticationMethod.ActiveDirectoryDeviceCodeFlow));
5959
}
@@ -69,15 +69,9 @@ public void CustomActiveDirectoryProviderTest_AppClientId()
6969
[Fact]
7070
public void CustomActiveDirectoryProviderTest_AppClientId_DeviceFlowCallback()
7171
{
72-
SqlAuthenticationProvider authProvider = new ActiveDirectoryAuthenticationProvider(CustomDeviceFlowCallback, Guid.NewGuid().ToString());
72+
SqlAuthenticationProvider authProvider = new ActiveDirectoryAuthenticationProvider(static (result) => Task.CompletedTask, Guid.NewGuid().ToString());
7373
SqlAuthenticationProvider.SetProvider(SqlAuthenticationMethod.ActiveDirectoryDeviceCodeFlow, authProvider);
7474
Assert.Equal(authProvider, SqlAuthenticationProvider.GetProvider(SqlAuthenticationMethod.ActiveDirectoryDeviceCodeFlow));
7575
}
76-
77-
private Task CustomDeviceFlowCallback(DeviceCodeResult result)
78-
{
79-
Console.WriteLine(result.Message);
80-
return Task.FromResult(0);
81-
}
8276
}
8377
}

src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlConnectionBasicTests.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public async Task PreLoginEncryptionExcludedTest()
6565
[PlatformSpecific(TestPlatforms.Windows)]
6666
public async Task TransientFaultTestAsync(uint errorCode)
6767
{
68-
using TransientFaultTDSServer server = TransientFaultTDSServer.StartTestServer(true, true, errorCode);
68+
using TransientFaultTDSServer server = TransientFaultTDSServer.StartTestServer(true, false, errorCode);
6969
SqlConnectionStringBuilder builder = new()
7070
{
7171
DataSource = "localhost," + server.Port,
@@ -85,7 +85,7 @@ public async Task TransientFaultTestAsync(uint errorCode)
8585
[PlatformSpecific(TestPlatforms.Windows)]
8686
public void TransientFaultTest(uint errorCode)
8787
{
88-
using TransientFaultTDSServer server = TransientFaultTDSServer.StartTestServer(true, true, errorCode);
88+
using TransientFaultTDSServer server = TransientFaultTDSServer.StartTestServer(true, false, errorCode);
8989
SqlConnectionStringBuilder builder = new()
9090
{
9191
DataSource = "localhost," + server.Port,
@@ -112,7 +112,7 @@ public void TransientFaultTest(uint errorCode)
112112
[PlatformSpecific(TestPlatforms.Windows)]
113113
public void TransientFaultDisabledTestAsync(uint errorCode)
114114
{
115-
using TransientFaultTDSServer server = TransientFaultTDSServer.StartTestServer(true, true, errorCode);
115+
using TransientFaultTDSServer server = TransientFaultTDSServer.StartTestServer(true, false, errorCode);
116116
SqlConnectionStringBuilder builder = new()
117117
{
118118
DataSource = "localhost," + server.Port,
@@ -134,7 +134,7 @@ public void TransientFaultDisabledTestAsync(uint errorCode)
134134
[PlatformSpecific(TestPlatforms.Windows)]
135135
public void TransientFaultDisabledTest(uint errorCode)
136136
{
137-
using TransientFaultTDSServer server = TransientFaultTDSServer.StartTestServer(true, true, errorCode);
137+
using TransientFaultTDSServer server = TransientFaultTDSServer.StartTestServer(true, false, errorCode);
138138
SqlConnectionStringBuilder builder = new()
139139
{
140140
DataSource = "localhost," + server.Port,

src/Microsoft.Data.SqlClient/tests/FunctionalTests/TestRoutingTdsServer.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static TestRoutingTdsServer StartTestServer(IPEndPoint destinationEndpoin
4242
server._endpoint = new TDSServerEndPoint(server) { ServerEndPoint = new IPEndPoint(IPAddress.Any, 0) };
4343
server._endpoint.EndpointName = methodName;
4444
// The server EventLog should be enabled as it logs the exceptions.
45-
server._endpoint.EventLog = Console.Out;
45+
server._endpoint.EventLog = enableLog ? Console.Out : null;
4646
server._endpoint.Start();
4747

4848
int port = server._endpoint.ServerEndPoint.Port;

src/Microsoft.Data.SqlClient/tests/FunctionalTests/TestTdsServer.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public static TestTdsServer StartServerWithQueryEngine(QueryEngine engine, bool
4949
server._endpoint = new TDSServerEndPoint(server) { ServerEndPoint = new IPEndPoint(IPAddress.Any, 0) };
5050
server._endpoint.EndpointName = methodName;
5151
// The server EventLog should be enabled as it logs the exceptions.
52-
server._endpoint.EventLog = Console.Out;
52+
server._endpoint.EventLog = enableLog ? Console.Out : null;
5353
server._endpoint.Start();
5454

5555
int port = server._endpoint.ServerEndPoint.Port;

src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj

-5
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,6 @@
244244
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
245245
<Link>data.xml</Link>
246246
</Content>
247-
<Content Include="ProviderAgnostic\MultipleResultsTest\MultipleResultsTest.bsl">
248-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
249-
<Link>MultipleResultsTest.bsl</Link>
250-
</Content>
251-
<None Include="ProviderAgnostic\MultipleResultsTest\MultipleResultsTest.bsl" />
252247
<None Include="SQL\ParameterTest\SqlParameterTest_DebugMode.bsl" />
253248
<None Include="SQL\ParameterTest\SqlParameterTest_DebugMode_Azure.bsl" />
254249
<None Include="SQL\ParameterTest\SqlParameterTest_ReleaseMode.bsl" />

src/Microsoft.Data.SqlClient/tests/ManualTests/ProviderAgnostic/MultipleResultsTest/MultipleResultsTest.bsl

-47
This file was deleted.

0 commit comments

Comments
 (0)