Merge branch 'master' into merge/release/3.1-to-master
This commit is contained in:
commit
d85b9a074a
|
|
@ -222,7 +222,7 @@ namespace Microsoft.Extensions.Logging.Testing
|
|||
|
||||
// Try to clear previous logs, continue if it fails.
|
||||
var assemblyBaseDirectory = TestFileOutputContext.GetAssemblyBaseDirectory(assembly);
|
||||
if (!string.IsNullOrEmpty(assemblyBaseDirectory))
|
||||
if (!string.IsNullOrEmpty(assemblyBaseDirectory) && !TestFileOutputContext.GetPreserveExistingLogsInOutput(assembly))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ namespace Microsoft.Extensions.Logging.Testing
|
|||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
|
||||
public class TestFrameworkFileLoggerAttribute : TestOutputDirectoryAttribute
|
||||
{
|
||||
public TestFrameworkFileLoggerAttribute(string tfm, string baseDirectory = null)
|
||||
: base(tfm, baseDirectory)
|
||||
public TestFrameworkFileLoggerAttribute(string preserveExistingLogsInOutput, string tfm, string baseDirectory = null)
|
||||
: base(preserveExistingLogsInOutput, tfm, baseDirectory)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,11 @@
|
|||
<Target Name="SetLoggingTestingAssemblyAttributes"
|
||||
BeforeTargets="GetAssemblyAttributes"
|
||||
Condition="'$(GenerateLoggingTestingAssemblyAttributes)' != 'false'">
|
||||
<PropertyGroup>
|
||||
<PreserveExistingLogsInOutput Condition="'$(PreserveExistingLogsInOutput)' == '' AND '$(ContinuousIntegrationBuild)' == 'true'">true</PreserveExistingLogsInOutput>
|
||||
<PreserveExistingLogsInOutput Condition="'$(PreserveExistingLogsInOutput)' == ''">false</PreserveExistingLogsInOutput>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AssemblyAttribute Include="Xunit.TestFramework">
|
||||
<_Parameter1>Microsoft.AspNetCore.Testing.AspNetTestFramework</_Parameter1>
|
||||
|
|
@ -16,8 +21,9 @@
|
|||
</AssemblyAttribute>
|
||||
|
||||
<AssemblyAttribute Include="Microsoft.Extensions.Logging.Testing.TestFrameworkFileLoggerAttribute">
|
||||
<_Parameter1>$(TargetFramework)</_Parameter1>
|
||||
<_Parameter2 Condition="'$(LoggingTestingDisableFileLogging)' != 'true'">$(LoggingTestingFileLoggingDirectory)</_Parameter2>
|
||||
<_Parameter1>$(PreserveExistingLogsInOutput)</_Parameter1>
|
||||
<_Parameter2>$(TargetFramework)</_Parameter2>
|
||||
<_Parameter3 Condition="'$(LoggingTestingDisableFileLogging)' != 'true'">$(LoggingTestingFileLoggingDirectory)</_Parameter3>
|
||||
</AssemblyAttribute>
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ using System.Reflection;
|
|||
using System.Runtime.CompilerServices;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Testing;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.Extensions.Logging.Testing.Tests
|
||||
|
|
@ -18,6 +19,17 @@ namespace Microsoft.Extensions.Logging.Testing.Tests
|
|||
private static readonly string ThisAssemblyName = ThisAssembly.GetName().Name;
|
||||
private static readonly string TFM = new DirectoryInfo(AppContext.BaseDirectory).Name;
|
||||
|
||||
[Fact]
|
||||
public void FunctionalLogs_LogsPreservedFromNonFlakyRun()
|
||||
{
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Flaky("http://example.com", FlakyOn.All)]
|
||||
public void FunctionalLogs_LogsPreservedFromFlakyRun()
|
||||
{
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ForAssembly_ReturnsSameInstanceForSameAssembly()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue