Skip to content

Commit

Permalink
[wasm] Disable threading and other tests that cause issues in Microso…
Browse files Browse the repository at this point in the history
…ft.Extensions.Logging (#38338)

Filed dotnet/runtime#38337 for the tests that cause a runtime assert.
The rest are normal threading ignores.
  • Loading branch information
akoeplinger authored and kevinwkt committed Jul 15, 2020
1 parent c09acb4 commit afb0cfd
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ private static string GetSyslogSeverityString(LogLevel level)
}
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void LogsWhenMessageIsNotProvided()
{
// Arrange
Expand Down Expand Up @@ -127,7 +127,7 @@ public void LogsWhenMessageIsNotProvided()
GetMessage(sink.Writes.GetRange(2 * t.WritesPerMsg, t.WritesPerMsg)));
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void DoesNotLog_NewLine_WhenNoExceptionIsProvided()
{
// Arrange
Expand Down Expand Up @@ -155,7 +155,7 @@ public void DoesNotLog_NewLine_WhenNoExceptionIsProvided()
Assert.Equal(expected2, GetMessage(sink.Writes.GetRange(3 * t.WritesPerMsg, t.WritesPerMsg)));
}

[Theory]
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[InlineData("Route with name 'Default' was not found.")]
public void Writes_NewLine_WhenExceptionIsProvided(string message)
{
Expand All @@ -179,7 +179,7 @@ public void Writes_NewLine_WhenExceptionIsProvided(string message)
Assert.Equal(expectedHeader + expectedMessage + expectedExceptionMessage, sink.Writes[1].Message);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void ThrowsException_WhenNoFormatterIsProvided()
{
// Arrange
Expand All @@ -190,7 +190,7 @@ public void ThrowsException_WhenNoFormatterIsProvided()
Assert.Throws<ArgumentNullException>(() => logger.Log<object>(LogLevel.Trace, 1, "empty", new Exception(), null));
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void LogsWhenNullFilterGiven()
{
// Arrange
Expand All @@ -211,7 +211,7 @@ public void LogsWhenNullFilterGiven()
Assert.Equal(expectedHeader + expectedMessage, sink.Writes[1].Message);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void WriteCritical_LogsCorrectColors()
{
// Arrange
Expand Down Expand Up @@ -253,7 +253,7 @@ public void WriteError_LogsCorrectColors()
Assert.Equal(TestConsole.DefaultForegroundColor, write.ForegroundColor);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void WriteWarning_LogsCorrectColors()
{
// Arrange
Expand All @@ -274,7 +274,7 @@ public void WriteWarning_LogsCorrectColors()
Assert.Equal(TestConsole.DefaultForegroundColor, write.ForegroundColor);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void WriteInformation_LogsCorrectColors()
{
// Arrange
Expand Down Expand Up @@ -316,7 +316,7 @@ public void WriteDebug_LogsCorrectColors()
Assert.Equal(TestConsole.DefaultForegroundColor, write.ForegroundColor);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void WriteTrace_LogsCorrectColors()
{
// Arrange
Expand All @@ -337,7 +337,7 @@ public void WriteTrace_LogsCorrectColors()
Assert.Equal(TestConsole.DefaultForegroundColor, write.ForegroundColor);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void WriteAllLevelsDisabledColors_LogsNoColors()
{
// Arrange
Expand All @@ -361,7 +361,7 @@ public void WriteAllLevelsDisabledColors_LogsNoColors()
}
}

[Theory]
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[MemberData(nameof(FormatsAndLevels))]
public void WriteCore_LogsCorrectTimestamp(ConsoleLoggerFormat format, LogLevel level)
{
Expand Down Expand Up @@ -443,7 +443,7 @@ public void WriteCore_LogsCorrectTimestampInUtc(ConsoleLoggerFormat format, LogL
}
}

[Theory]
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[MemberData(nameof(FormatsAndLevels))]
public void WriteCore_LogsCorrectMessages(ConsoleLoggerFormat format, LogLevel level)
{
Expand Down Expand Up @@ -487,7 +487,7 @@ public void WriteCore_LogsCorrectMessages(ConsoleLoggerFormat format, LogLevel l
}
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void NoLogScope_DoesNotWriteAnyScopeContentToOutput()
{
// Arrange
Expand Down Expand Up @@ -534,7 +534,7 @@ public void WritingScopes_LogsWithCorrectColors()
Assert.Equal(TestConsole.DefaultForegroundColor, write.ForegroundColor);
}

[Theory]
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[MemberData(nameof(Formats))]
public void WritingScopes_LogsExpectedMessage(ConsoleLoggerFormat format)
{
Expand Down Expand Up @@ -585,7 +585,7 @@ public void WritingScopes_LogsExpectedMessage(ConsoleLoggerFormat format)
}
}

[Theory]
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[MemberData(nameof(Formats))]
public void WritingNestedScope_LogsNullScopeName(ConsoleLoggerFormat format)
{
Expand Down Expand Up @@ -634,7 +634,7 @@ public void WritingNestedScope_LogsNullScopeName(ConsoleLoggerFormat format)
}
}

[Theory]
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[MemberData(nameof(Formats))]
public void WritingNestedScopes_LogsExpectedMessage(ConsoleLoggerFormat format)
{
Expand Down Expand Up @@ -688,7 +688,7 @@ public void WritingNestedScopes_LogsExpectedMessage(ConsoleLoggerFormat format)
}
}

[Theory]
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[MemberData(nameof(Formats))]
public void WritingMultipleScopes_LogsExpectedMessage(ConsoleLoggerFormat format)
{
Expand Down Expand Up @@ -757,7 +757,7 @@ public void WritingMultipleScopes_LogsExpectedMessage(ConsoleLoggerFormat format
}
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void CallingBeginScopeOnLogger_AlwaysReturnsNewDisposableInstance()
{
// Arrange
Expand All @@ -775,7 +775,7 @@ public void CallingBeginScopeOnLogger_AlwaysReturnsNewDisposableInstance()
Assert.NotSame(disposable1, disposable2);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void CallingBeginScopeOnLogger_ReturnsNonNullableInstance()
{
// Arrange
Expand All @@ -790,7 +790,7 @@ public void CallingBeginScopeOnLogger_ReturnsNonNullableInstance()
Assert.NotNull(disposable);
}

[Theory]
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[MemberData(nameof(Formats))]
public void ConsoleLoggerLogsToError_WhenOverErrorLevel(ConsoleLoggerFormat format)
{
Expand Down Expand Up @@ -840,7 +840,7 @@ public void ConsoleLoggerLogsToError_WhenOverErrorLevel(ConsoleLoggerFormat form
}
}

[Theory]
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[MemberData(nameof(FormatsAndLevels))]
public void WriteCore_NullMessageWithException(ConsoleLoggerFormat format, LogLevel level)
{
Expand Down Expand Up @@ -884,7 +884,7 @@ public void WriteCore_NullMessageWithException(ConsoleLoggerFormat format, LogLe
}
}

[Theory]
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[MemberData(nameof(FormatsAndLevels))]
public void WriteCore_EmptyMessageWithException(ConsoleLoggerFormat format, LogLevel level)
{
Expand Down Expand Up @@ -927,7 +927,7 @@ public void WriteCore_EmptyMessageWithException(ConsoleLoggerFormat format, LogL
}
}

[Theory]
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[MemberData(nameof(FormatsAndLevels))]
public void WriteCore_MessageWithNullException(ConsoleLoggerFormat format, LogLevel level)
{
Expand Down Expand Up @@ -967,7 +967,7 @@ public void WriteCore_MessageWithNullException(ConsoleLoggerFormat format, LogLe
}
}

[Theory]
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[MemberData(nameof(Levels))]
public void WriteCore_NullMessageWithNullException(LogLevel level)
{
Expand All @@ -985,7 +985,7 @@ public void WriteCore_NullMessageWithNullException(LogLevel level)
Assert.Empty(sink.Writes);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void LogAfterDisposeWritesLog()
{
// Arrange
Expand All @@ -1004,7 +1004,7 @@ public void LogAfterDisposeWritesLog()
Assert.True(sink.Writes.Count == 2);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public static void IsEnabledReturnsCorrectValue()
{
var logger = SetUp().Logger;
Expand All @@ -1018,7 +1018,7 @@ public static void IsEnabledReturnsCorrectValue()
Assert.True(logger.IsEnabled(LogLevel.Trace));
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void ConsoleLoggerOptions_DisableColors_IsAppliedToLoggers()
{
// Arrange
Expand All @@ -1033,6 +1033,7 @@ public void ConsoleLoggerOptions_DisableColors_IsAppliedToLoggers()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/38337", TestPlatforms.Browser)]
public void ConsoleLoggerOptions_DisableColors_IsReadFromLoggingConfiguration()
{
var configuration = new ConfigurationBuilder().AddInMemoryCollection(new[] { new KeyValuePair<string, string>("Console:DisableColors", "true") }).Build();
Expand All @@ -1049,7 +1050,7 @@ public void ConsoleLoggerOptions_DisableColors_IsReadFromLoggingConfiguration()
Assert.True(logger.Options.DisableColors);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void ConsoleLoggerOptions_TimeStampFormat_IsReloaded()
{
// Arrange
Expand All @@ -1064,6 +1065,7 @@ public void ConsoleLoggerOptions_TimeStampFormat_IsReloaded()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/38337", TestPlatforms.Browser)]
public void ConsoleLoggerOptions_TimeStampFormat_IsReadFromLoggingConfiguration()
{
var configuration = new ConfigurationBuilder().AddInMemoryCollection(new[] { new KeyValuePair<string, string>("Console:TimeStampFormat", "yyyyMMddHHmmss") }).Build();
Expand All @@ -1080,7 +1082,7 @@ public void ConsoleLoggerOptions_TimeStampFormat_IsReadFromLoggingConfiguration(
Assert.Equal("yyyyMMddHHmmss", logger.Options.TimestampFormat);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void ConsoleLoggerOptions_TimeStampFormat_MultipleReloads()
{
var monitor = new TestOptionsMonitor(new ConsoleLoggerOptions());
Expand All @@ -1094,7 +1096,7 @@ public void ConsoleLoggerOptions_TimeStampFormat_MultipleReloads()
Assert.Equal("yyyyMMddHHmmss", logger.Options.TimestampFormat);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void ConsoleLoggerOptions_IncludeScopes_IsAppliedToLoggers()
{
// Arrange
Expand All @@ -1109,6 +1111,7 @@ public void ConsoleLoggerOptions_IncludeScopes_IsAppliedToLoggers()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/38337", TestPlatforms.Browser)]
public void ConsoleLoggerOptions_LogAsErrorLevel_IsReadFromLoggingConfiguration()
{
var configuration = new ConfigurationBuilder().AddInMemoryCollection(new[] { new KeyValuePair<string, string>("Console:LogToStandardErrorThreshold", "Warning") }).Build();
Expand All @@ -1125,7 +1128,7 @@ public void ConsoleLoggerOptions_LogAsErrorLevel_IsReadFromLoggingConfiguration(
Assert.Equal(LogLevel.Warning, logger.Options.LogToStandardErrorThreshold);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void ConsoleLoggerOptions_LogAsErrorLevel_IsAppliedToLoggers()
{
// Arrange
Expand All @@ -1139,7 +1142,7 @@ public void ConsoleLoggerOptions_LogAsErrorLevel_IsAppliedToLoggers()
Assert.Equal(LogLevel.Error, logger.Options.LogToStandardErrorThreshold);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void ConsoleLoggerOptions_UseUtcTimestamp_IsAppliedToLoggers()
{
// Arrange
Expand All @@ -1154,6 +1157,7 @@ public void ConsoleLoggerOptions_UseUtcTimestamp_IsAppliedToLoggers()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/38337", TestPlatforms.Browser)]
public void ConsoleLoggerOptions_IncludeScopes_IsReadFromLoggingConfiguration()
{
var configuration = new ConfigurationBuilder().AddInMemoryCollection(new[] { new KeyValuePair<string, string>("Console:IncludeScopes", "true") }).Build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ public void TestActivityIds(ActivityTrackingOptions options)
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/38337", TestPlatforms.Browser)]
public void TestInvalidActivityTrackingOptions()
{
Assert.Throws<ArgumentException>(() =>
Expand Down

0 comments on commit afb0cfd

Please sign in to comment.