Skip to content

Commit

Permalink
Disable flaky DNS cancellation tests during jitstress (#70089)
Browse files Browse the repository at this point in the history
* Revert "Reenable GetHostAddressesTest_Cancellation on Unix (#70009)"

This reverts commit e8b9592.

* Revert "Fix flakyness of DnsGetHostAddresses_PostCancelledToken_Throws (#70044)"

This reverts commit a466063.

* Disable flaky tests on jitstress

* fixup! Disable flaky tests on jitstress
  • Loading branch information
rzikm authored Jun 2, 2022
1 parent 2f82cb8 commit f873951
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,26 +178,25 @@ public async Task DnsGetHostAddresses_PreCancelledToken_Throws()
public class GetHostAddressesTest_Cancellation
{
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/33378", TestPlatforms.AnyUnix)] // Cancellation of an outstanding getaddrinfo is not supported on *nix.
[SkipOnCoreClr("JitStress interferes with cancellation timing", RuntimeTestModes.JitStress | RuntimeTestModes.JitStressRegs)]
public async Task DnsGetHostAddresses_PostCancelledToken_Throws()
{
using var cts = new CancellationTokenSource();

Task task = Dns.GetHostAddressesAsync(TestSettings.UncachedHost, cts.Token);
cts.Cancel();

// This test is nondeterministic, the cancellation may take too long to trigger:
// This test might flake if the cancellation token takes too long to trigger:
// It's a race between the DNS server getting back to us and the cancellation processing.
// since the host does not exist, both cases throw an exception.
Exception ex = await Assert.ThrowsAnyAsync<Exception>(() => task);
if (ex is OperationCanceledException oce)
{
// canceled in time
Assert.Equal(cts.Token, oce.CancellationToken);
}
cts.Cancel();

OperationCanceledException oce = await Assert.ThrowsAnyAsync<OperationCanceledException>(() => task);
Assert.Equal(cts.Token, oce.CancellationToken);
}

// This is a regression test for https://github.com/dotnet/runtime/issues/63552
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/33378", TestPlatforms.AnyUnix)] // Cancellation of an outstanding getaddrinfo is not supported on *nix.
public async Task DnsGetHostAddresses_ResolveParallelCancelOnFailure_AllCallsReturn()
{
string invalidAddress = TestSettings.UncachedHost;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public async Task Dns_GetHostEntry_HostString_Ok(string hostName)
[ConditionalTheory(nameof(GetHostEntryWorks))]
[InlineData("")]
[InlineData(TestSettings.LocalHost)]
public async Task Dns_GetHostEntryAsync_HostString_Ok(string hostName)
public async Task Dns_GetHostEntryAsync_HostString_Ok(string hostName)
{
await TestGetHostEntryAsync(() => Dns.GetHostEntryAsync(hostName));
}
Expand Down Expand Up @@ -122,7 +122,7 @@ static void RunTest(string hostnameInner)
{
Assert.NotEqual(AddressFamily.InterNetworkV6, address.AddressFamily);
}
}
}
}

[ConditionalTheory(nameof(GetHostEntry_DisableIPv6_Condition))]
Expand Down Expand Up @@ -315,9 +315,10 @@ public async Task DnsGetHostEntry_PreCancelledToken_Throws()
[Collection(nameof(DisableParallelization))]
public class GetHostEntryTest_Cancellation
{
[Fact]
[OuterLoop]
[ActiveIssue("https://github.com/dotnet/runtime/issues/33378", TestPlatforms.AnyUnix)] // Cancellation of an outstanding getaddrinfo is not supported on *nix.
[Fact]
[SkipOnCoreClr("JitStress interferes with cancellation timing", RuntimeTestModes.JitStress | RuntimeTestModes.JitStressRegs)]
public async Task DnsGetHostEntry_PostCancelledToken_Throws()
{
// Windows 7 name resolution is synchronous and does not respect cancellation.
Expand Down

0 comments on commit f873951

Please sign in to comment.