Skip to content

Commit

Permalink
Revert "Adding A log presence check before trying to delete (dotnet#3…
Browse files Browse the repository at this point in the history
…6779)"

This reverts commit 96401ea.
  • Loading branch information
safern committed Jun 2, 2020
1 parent 6e51500 commit 222bb40
Showing 1 changed file with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
// See the LICENSE file in the project root for more information.

using Xunit;
using Microsoft.DotNet.XUnitExtensions;

namespace System.Diagnostics.Tests
{
public class EventLogSourceCreationTests
{
[ActiveIssue("https://github.com/dotnet/runtime/issues/36135")]
[ConditionalFact(typeof(Helpers), nameof(Helpers.IsElevatedAndSupportsEventLogs))]
public void CheckSourceExistenceAndDeletion()
{
Expand All @@ -21,13 +23,13 @@ public void CheckSourceExistenceAndDeletion()
finally
{
EventLog.DeleteEventSource(source);
if (EventLog.Exists(log))
Helpers.Retry(() => EventLog.Delete(log));
Helpers.Retry(() => EventLog.Delete(log)); // unlike other tests, throw if delete fails
}

Assert.False(EventLog.SourceExists(source));
}

[ActiveIssue("https://github.com/dotnet/runtime/issues/36135")]
[ConditionalFact(typeof(Helpers), nameof(Helpers.IsElevatedAndSupportsEventLogs))]
[SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)]
public void LogNameWithSame8FirstChars_NetCore()
Expand All @@ -48,15 +50,13 @@ public void LogNameWithSame8FirstChars_NetCore()
finally
{
EventLog.DeleteEventSource(firstSource);
if (EventLog.Exists(firstLog))
Helpers.Retry(() => EventLog.Delete(firstLog));

Helpers.Retry(() => EventLog.Delete(firstLog));
EventLog.DeleteEventSource(secondSource);
if (EventLog.Exists(secondLog))
Helpers.Retry(() => EventLog.Delete(secondLog));
Helpers.Retry(() => EventLog.Delete(secondLog));
}
}

[ActiveIssue("https://github.com/dotnet/runtime/issues/36135")]
[ConditionalFact(typeof(Helpers), nameof(Helpers.IsElevatedAndSupportsEventLogs))]
[SkipOnTargetFramework(~TargetFrameworkMonikers.NetFramework)]
public void LogNameWithSame8FirstChars_NetFramework()
Expand All @@ -75,8 +75,7 @@ public void LogNameWithSame8FirstChars_NetFramework()
finally
{
EventLog.DeleteEventSource(firstSource);
if (EventLog.Exists(firstLog))
Helpers.Retry(() => EventLog.Delete(firstLog));
Helpers.Retry(() => EventLog.Delete(firstLog));
}
}

Expand Down Expand Up @@ -146,6 +145,7 @@ public void SourceDataNull()
Assert.Throws<ArgumentNullException>(() => EventLog.CreateEventSource(null));
}

[ActiveIssue("https://github.com/dotnet/runtime/issues/36135")]
[ConditionalFact(typeof(Helpers), nameof(Helpers.IsElevatedAndSupportsEventLogs))]
public void SourceAlreadyExistsWhenCreatingSource()
{
Expand All @@ -160,8 +160,7 @@ public void SourceAlreadyExistsWhenCreatingSource()
finally
{
EventLog.DeleteEventSource(source);
if (EventLog.Exists(log))
Helpers.RetrySilently(() => EventLog.Delete(log));
Helpers.RetrySilently(() => EventLog.Delete(log));
}
}

Expand Down

0 comments on commit 222bb40

Please sign in to comment.