Skip to content

Commit

Permalink
Skip logs functional tests for .NET Core 3.1 on Windows. (#808)
Browse files Browse the repository at this point in the history
Skip logs functional tests for .NET Core 3.1 on Windows.
  • Loading branch information
jander-msft authored Sep 2, 2021
1 parent f9adcbb commit 8a10567
Showing 1 changed file with 23 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using System.IO;
using System.Net;
using System.Net.Http;
using System.Runtime.InteropServices;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading.Channels;
Expand All @@ -44,7 +45,7 @@ public LogsTests(ITestOutputHelper outputHelper, ServiceProviderFixture serviceP
/// <summary>
/// Tests that all log events are collected if log level set to Trace.
/// </summary>
[Theory]
[ConditionalTheory(nameof(SkipOnWindowsNetCore31))]
[InlineData(DiagnosticPortConnectionMode.Connect, LogFormat.JsonSequence)]
[InlineData(DiagnosticPortConnectionMode.Connect, LogFormat.NDJson)]

Expand Down Expand Up @@ -90,7 +91,7 @@ public Task LogsAllCategoriesTest(DiagnosticPortConnectionMode mode, LogFormat l
/// <summary>
/// Tests that log events with level at or above the specified level are collected.
/// </summary>
[Theory]
[ConditionalTheory(nameof(SkipOnWindowsNetCore31))]
[InlineData(DiagnosticPortConnectionMode.Connect, LogFormat.JsonSequence)]
[InlineData(DiagnosticPortConnectionMode.Connect, LogFormat.NDJson)]
#if NET5_0_OR_GREATER
Expand Down Expand Up @@ -122,7 +123,7 @@ public Task LogsDefaultLevelTest(DiagnosticPortConnectionMode mode, LogFormat lo
/// Test that log events with a category that doesn't have a specified level are collected
/// at the log level specified in the request body.
/// </summary>
[Theory]
[ConditionalTheory(nameof(SkipOnWindowsNetCore31))]
[InlineData(DiagnosticPortConnectionMode.Connect, LogFormat.JsonSequence)]
[InlineData(DiagnosticPortConnectionMode.Connect, LogFormat.NDJson)]
#if NET5_0_OR_GREATER
Expand Down Expand Up @@ -163,7 +164,7 @@ public Task LogsDefaultLevelFallbackTest(DiagnosticPortConnectionMode mode, LogF
/// <summary>
/// Test that LogLevel.None is not supported as the level query parameter.
/// </summary>
[Theory]
[ConditionalTheory(nameof(SkipOnWindowsNetCore31))]
[InlineData(DiagnosticPortConnectionMode.Connect, LogFormat.JsonSequence)]
[InlineData(DiagnosticPortConnectionMode.Connect, LogFormat.NDJson)]
#if NET5_0_OR_GREATER
Expand Down Expand Up @@ -199,7 +200,7 @@ public Task LogsDefaultLevelNoneNotSupportedViaQueryTest(DiagnosticPortConnectio
/// <summary>
/// Test that LogLevel.None is not supported as the default log level in the request body.
/// </summary>
[Theory]
[ConditionalTheory(nameof(SkipOnWindowsNetCore31))]
[InlineData(DiagnosticPortConnectionMode.Connect, LogFormat.JsonSequence)]
[InlineData(DiagnosticPortConnectionMode.Connect, LogFormat.NDJson)]
#if NET5_0_OR_GREATER
Expand Down Expand Up @@ -235,7 +236,7 @@ public Task LogsDefaultLevelNoneNotSupportedViaBodyTest(DiagnosticPortConnection
/// <summary>
/// Test that log events are collected for the categories and levels specified by the application.
/// </summary>
[Theory]
[ConditionalTheory(nameof(SkipOnWindowsNetCore31))]
[InlineData(DiagnosticPortConnectionMode.Connect, LogFormat.JsonSequence)]
[InlineData(DiagnosticPortConnectionMode.Connect, LogFormat.NDJson)]
#if NET5_0_OR_GREATER
Expand Down Expand Up @@ -269,7 +270,7 @@ public Task LogsUseAppFiltersViaQueryTest(DiagnosticPortConnectionMode mode, Log
/// <summary>
/// Test that log events are collected for the categories and levels specified by the application.
/// </summary>
[Theory]
[ConditionalTheory(nameof(SkipOnWindowsNetCore31))]
[InlineData(DiagnosticPortConnectionMode.Connect, LogFormat.JsonSequence)]
[InlineData(DiagnosticPortConnectionMode.Connect, LogFormat.NDJson)]
#if NET5_0_OR_GREATER
Expand Down Expand Up @@ -308,7 +309,7 @@ public Task LogsUseAppFiltersViaBodyTest(DiagnosticPortConnectionMode mode, LogF
/// Test that log events are collected for the categories and levels specified by the application
/// and for the categories and levels specified in the filter specs.
/// </summary>
[Theory]
[ConditionalTheory(nameof(SkipOnWindowsNetCore31))]
[InlineData(DiagnosticPortConnectionMode.Connect, LogFormat.JsonSequence)]
[InlineData(DiagnosticPortConnectionMode.Connect, LogFormat.NDJson)]
#if NET5_0_OR_GREATER
Expand Down Expand Up @@ -352,7 +353,7 @@ public Task LogsUseAppFiltersAndFilterSpecsTest(DiagnosticPortConnectionMode mod
/// <summary>
/// Test that log events are collected for wildcard categories.
/// </summary>
[Theory]
[ConditionalTheory(nameof(SkipOnWindowsNetCore31))]
[InlineData(DiagnosticPortConnectionMode.Connect, LogFormat.JsonSequence)]
[InlineData(DiagnosticPortConnectionMode.Connect, LogFormat.NDJson)]
#if NET5_0_OR_GREATER
Expand Down Expand Up @@ -688,6 +689,19 @@ private static LogEntry CreateCriticalEntry(string category)
};
}

public static bool SkipOnWindowsNetCore31
{
get
{
// Skip logs tests for .NET Core 3.1 on Windows; these tests sporadically
// fail frequently causing insertions and builds with unrelated changes to
// fail. See https://github.com/dotnet/dotnet-monitor/issues/807 for details.
return !RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ||
DotNetHost.RuntimeVersion.Major != 3 ||
DotNetHost.RuntimeVersion.Minor != 1;
}
}

private static readonly LogEntry Category1TraceEntry =
CreateTraceEntry(TestAppScenarios.Logger.Categories.LoggerCategory1);

Expand Down

0 comments on commit 8a10567

Please sign in to comment.