Skip to content

Commit c5bc1ce

Browse files
committed
responding to review feedback
1 parent 534c395 commit c5bc1ce

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Common/Commands.Common.Authentication/Factories/CancelRetryHandler.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// ----------------------------------------------------------------------------------
1414

1515
using System;
16+
using System.Linq;
1617
using System.Net.Http;
1718
using System.Threading;
1819
using System.Threading.Tasks;
@@ -26,7 +27,8 @@ namespace Microsoft.Azure.Commands.Common.Authentication.Factories
2627
/// </summary>
2728
public class CancelRetryHandler : DelegatingHandler, ICloneable
2829
{
29-
const string TestModeVariableKey = "Azure_Test_Mode", TestModeVariableValue="Record";
30+
static readonly string[] TestModeLiveValues = { "Record", "None", "Live" };
31+
const string TestModeVariableKey = "Azure_Test_Mode";
3032
public CancelRetryHandler()
3133
{
3234
WaitInterval = TimeSpan.Zero;
@@ -64,7 +66,7 @@ protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage
6466
void SleepIfRunningLive(TimeSpan timeSpan)
6567
{
6668
var testModeSetting = Environment.GetEnvironmentVariable(TestModeVariableKey);
67-
if (string.IsNullOrWhiteSpace(testModeSetting) || !string.Equals(TestModeVariableValue, testModeSetting, StringComparison.OrdinalIgnoreCase))
69+
if (string.IsNullOrWhiteSpace(testModeSetting) || TestModeLiveValues.Any( v => string.Equals(v, testModeSetting, StringComparison.OrdinalIgnoreCase)))
6870
{
6971
Thread.Sleep(timeSpan);
7072
}

0 commit comments

Comments
 (0)