Skip to content

Commit

Permalink
Shorten polling intervals for test playback
Browse files Browse the repository at this point in the history
  • Loading branch information
heaths committed Sep 1, 2020
1 parent fba9094 commit 2cb864e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ public async Task DeleteEcHsmKey()

DeleteKeyOperation operation = await Client.StartDeleteKeyAsync(keyName);

DeletedKey deletedKey = await operation.WaitForCompletionAsync();
DeletedKey deletedKey = await operation.WaitForCompletionAsync(PollingInterval, default);

Assert.NotNull(deletedKey.DeletedOn);
Assert.NotNull(deletedKey.RecoveryId);
Expand All @@ -608,7 +608,7 @@ public async Task DeleteRsaHsmKey()

DeleteKeyOperation operation = await Client.StartDeleteKeyAsync(keyName);

DeletedKey deletedKey = await operation.WaitForCompletionAsync();
DeletedKey deletedKey = await operation.WaitForCompletionAsync(PollingInterval, default);

Assert.NotNull(deletedKey.DeletedOn);
Assert.NotNull(deletedKey.RecoveryId);
Expand Down Expand Up @@ -660,7 +660,7 @@ public async Task GetDeletedEcHsmKey()

DeleteKeyOperation operation = await Client.StartDeleteKeyAsync(keyName);

DeletedKey deletedKey = await operation.WaitForCompletionAsync();
DeletedKey deletedKey = await operation.WaitForCompletionAsync(PollingInterval, default);

await WaitForDeletedKey(keyName);

Expand All @@ -686,7 +686,7 @@ public async Task GetDeletedRsaHsmKey()

DeleteKeyOperation operation = await Client.StartDeleteKeyAsync(keyName);

DeletedKey deletedKey = await operation.WaitForCompletionAsync();
DeletedKey deletedKey = await operation.WaitForCompletionAsync(PollingInterval, default);

await WaitForDeletedKey(keyName);

Expand Down Expand Up @@ -745,15 +745,15 @@ public async Task RecoverDeletedEcHsmKey()

DeleteKeyOperation deleteOperation = await Client.StartDeleteKeyAsync(keyName);

DeletedKey deletedKey = await deleteOperation.WaitForCompletionAsync();
DeletedKey deletedKey = await deleteOperation.WaitForCompletionAsync(PollingInterval, default);

await WaitForDeletedKey(keyName);

Assert.ThrowsAsync<RequestFailedException>(() => Client.GetKeyAsync(keyName));

RecoverDeletedKeyOperation recoverOperation = await Client.StartRecoverDeletedKeyAsync(keyName);

KeyVaultKey recoverKeyResult = await recoverOperation.WaitForCompletionAsync();
KeyVaultKey recoverKeyResult = await recoverOperation.WaitForCompletionAsync(PollingInterval, default);

await WaitForKey(keyName);

Expand All @@ -777,15 +777,15 @@ public async Task RecoverDeletedRsaHsmKey()

DeleteKeyOperation deleteOperation = await Client.StartDeleteKeyAsync(keyName);

DeletedKey deletedKey = await deleteOperation.WaitForCompletionAsync();
DeletedKey deletedKey = await deleteOperation.WaitForCompletionAsync(PollingInterval, default);

await WaitForDeletedKey(keyName);

Assert.ThrowsAsync<RequestFailedException>(() => Client.GetKeyAsync(keyName));

RecoverDeletedKeyOperation recoverOperation = await Client.StartRecoverDeletedKeyAsync(keyName);

KeyVaultKey recoverKeyResult = await recoverOperation.WaitForCompletionAsync();
KeyVaultKey recoverKeyResult = await recoverOperation.WaitForCompletionAsync(PollingInterval, default);

await WaitForKey(keyName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ public abstract class KeysTestBase : RecordedTestBase<KeyVaultTestEnvironment>
{
public const string AzureKeyVaultUrlEnvironmentVariable = "AZURE_KEYVAULT_URL";

protected readonly TimeSpan PollingInterval = TimeSpan.FromSeconds(5);
protected TimeSpan PollingInterval => Recording.Mode == RecordedTestMode.Playback
? TimeSpan.Zero
: TimeSpan.FromSeconds(2);

public KeyClient Client { get; set; }

Expand Down

0 comments on commit 2cb864e

Please sign in to comment.