Skip to content

Commit f15e870

Browse files
authored
Merge pull request #199 from DataDog/fix/integration-tests
fix: resolve .NET integration test issues
2 parents 2352c7d + 85b986c commit f15e870

4 files changed

Lines changed: 21 additions & 14 deletions

File tree

print-service/tests/Stickerlandia.PrintService.IntegrationTest/Drivers/PrinterDriver.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
using Stickerlandia.PrintService.IntegrationTest.ViewModels;
1111
using Xunit.Abstractions;
1212

13-
#pragma warning disable CA2234, CA2000
13+
#pragma warning disable CA2234, CA2000, CA5400
1414

1515
namespace Stickerlandia.PrintService.IntegrationTest.Drivers;
1616

@@ -30,8 +30,9 @@ public PrinterDriver(ITestOutputHelper testOutputHelper, HttpClient httpClient,
3030
{
3131
CookieContainer = cookieContainer,
3232
UseCookies = true,
33-
CheckCertificateRevocationList = true,
34-
AllowAutoRedirect = true
33+
AllowAutoRedirect = true,
34+
ServerCertificateCustomValidationCallback =
35+
HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
3536
};
3637

3738
_httpClient = new HttpClient(httpHandler, true)

print-service/tests/Stickerlandia.PrintService.IntegrationTest/Hooks/TestSetupFixture.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// This product includes software developed at Datadog (https://www.datadoghq.com/).
99
// Copyright 2025 Datadog, Inc.
1010

11-
#pragma warning disable CA1515,CA1063,CA2012,CA2000
11+
#pragma warning disable CA1515,CA1063,CA2012,CA2000,CA5400
1212

1313
using Aspire.Hosting;
1414
using Aspire.Hosting.Testing;
@@ -96,7 +96,8 @@ public TestSetupFixture()
9696
var handler = new HttpClientHandler
9797
{
9898
UseCookies = true,
99-
CheckCertificateRevocationList = true
99+
ServerCertificateCustomValidationCallback =
100+
HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
100101
};
101102

102103
HttpClient = new HttpClient(handler, true)
@@ -144,7 +145,8 @@ private static HttpClient CreateHttpClientWithFallback()
144145
var handler = new HttpClientHandler
145146
{
146147
UseCookies = true,
147-
CheckCertificateRevocationList = true
148+
ServerCertificateCustomValidationCallback =
149+
HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
148150
};
149151

150152
return new HttpClient(handler, true)

user-management/tests/Stickerlandia.UserManagement.IntegrationTest/Drivers/AccountDriver.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
using Stickerlandia.UserManagement.IntegrationTest.ViewModels;
1313
using Xunit.Abstractions;
1414

15-
#pragma warning disable CA2234, CA2000, CA1031
15+
#pragma warning disable CA2234, CA2000, CA1031, CA5400
1616

1717
#pragma warning disable CA1812
1818

@@ -36,17 +36,19 @@ public AccountDriver(ITestOutputHelper testOutputHelper, HttpClient httpClient,
3636
{
3737
CookieContainer = cookieContainer,
3838
UseCookies = true,
39-
CheckCertificateRevocationList = true,
40-
AllowAutoRedirect = false
39+
AllowAutoRedirect = false,
40+
ServerCertificateCustomValidationCallback =
41+
HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
4142
};
4243

4344
// Create a separate HttpClient for OAuth2.0 operations that doesn't auto-follow redirects
4445
var mainHttpHandler = new HttpClientHandler
4546
{
4647
CookieContainer = cookieContainer,
4748
UseCookies = true,
48-
CheckCertificateRevocationList = true,
49-
AllowAutoRedirect = true
49+
AllowAutoRedirect = true,
50+
ServerCertificateCustomValidationCallback =
51+
HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
5052
};
5153

5254
_oauthClient = new HttpClient(oauthHandler, true)

user-management/tests/Stickerlandia.UserManagement.IntegrationTest/Hooks/TestSetupFixture.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// This product includes software developed at Datadog (https://www.datadoghq.com/).
99
// Copyright 2025 Datadog, Inc.
1010

11-
#pragma warning disable CA1515,CA1063,CA2012,CA2000
11+
#pragma warning disable CA1515,CA1063,CA2012,CA2000,CA5400
1212

1313
using Aspire.Hosting;
1414
using Aspire.Hosting.Testing;
@@ -89,7 +89,8 @@ public TestSetupFixture()
8989
var handler = new HttpClientHandler
9090
{
9191
UseCookies = true,
92-
CheckCertificateRevocationList = true
92+
ServerCertificateCustomValidationCallback =
93+
HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
9394
};
9495

9596
HttpClient = new HttpClient(handler, true)
@@ -140,7 +141,8 @@ private static HttpClient CreateHttpClientWithFallback()
140141
var handler = new HttpClientHandler
141142
{
142143
UseCookies = true,
143-
CheckCertificateRevocationList = true
144+
ServerCertificateCustomValidationCallback =
145+
HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
144146
};
145147

146148
return new HttpClient(handler, true)

0 commit comments

Comments
 (0)