-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolve a few flaky Key Vault tests (#19612)
* Wait longer for deleted keys * Fix net5.0 tests on OSX * Add EventSource for CertificateOperation Added more logging to better diagnose how #17718 is happening. * Always get start time from stopwatch ...in case the event source is initially disabled, but enabled in the middle (elapsed time would be very long). * Fix broken test on OSX * More fixes for OSX * Resolve PR feedback * Re-enable some tests and increasing polling interval * Ignore VerifyECDecoderPrime256v1Imported on OSX
- Loading branch information
Showing
10 changed files
with
433 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
sdk/keyvault/Azure.Security.KeyVault.Certificates/src/CertificatesEventSource.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System.Diagnostics.Tracing; | ||
using Azure.Core.Diagnostics; | ||
|
||
namespace Azure.Security.KeyVault.Certificates | ||
{ | ||
[EventSource(Name = EventSourceName)] | ||
internal sealed class CertificatesEventSource : EventSource | ||
{ | ||
internal const int BeginUpdateStatusEvent = 1; | ||
internal const int EndUpdateStatusEvent = 2; | ||
|
||
private const string EventSourceName = "Azure-Security-KeyVault-Certificates"; | ||
private const string Deleted = "(deleted)"; | ||
private const string NoError = "(none)"; | ||
|
||
private CertificatesEventSource() : base(EventSourceName, EventSourceSettings.Default, AzureEventSourceListener.TraitName, AzureEventSourceListener.TraitValue) { } | ||
|
||
public static CertificatesEventSource Singleton { get; } = new CertificatesEventSource(); | ||
|
||
[NonEvent] | ||
public void BeginUpdateStatus(CertificateOperationProperties properties) => | ||
BeginUpdateStatus(properties?.Id.ToString(), properties?.Status, properties?.Error?.Message); | ||
|
||
[Event(BeginUpdateStatusEvent, Level = EventLevel.Verbose, Message = "Updating certificate operation status: {0}, current status: {1}, error: {2}")] | ||
public void BeginUpdateStatus(string id, string status, string error) => WriteEvent(BeginUpdateStatusEvent, id ?? Deleted, status, error ?? NoError); | ||
|
||
[NonEvent] | ||
public void EndUpdateStatus(CertificateOperationProperties properties) => | ||
EndUpdateStatus(properties?.Id.ToString(), properties?.Status, properties?.Error?.Message); | ||
|
||
[Event(EndUpdateStatusEvent, Level = EventLevel.Verbose, Message = "Updated certificate operation status: {0}, ending status: {1}, error: {2}")] | ||
public void EndUpdateStatus(string id, string status, string error) => WriteEvent(EndUpdateStatusEvent, id ?? Deleted, status, error ?? NoError); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.