Skip to content

Commit

Permalink
[Communication] - PhoneNumbers - Require phone number pool in livetes…
Browse files Browse the repository at this point in the history
…ts (Azure#27093)

* Require phone number pool in livetests

* Fix conditional statement with the correct value

* Fix formatting
  • Loading branch information
danielortega-msft authored Feb 18, 2022
1 parent 41b11af commit 8545cde
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class CommunicationTestEnvironment : TestEnvironment

public string LiveTestStaticAccessKey => Core.ConnectionString.Parse(LiveTestStaticConnectionString).GetRequired("accesskey");

public string CommunicationTestPhoneNumber => GetPhoneNumberByTestAgent() ?? GetRecordedVariable(AzurePhoneNumber, options => options.IsSecret("+14255550123"));
public string DefaultTestPhoneNumber => GetRecordedVariable(AzurePhoneNumber, options => options.IsSecret("+14255550123"));

public string SkipSmsTest => GetOptionalVariable(SkipIntSmsTestEnvironmentVariableName) ?? "False";

Expand All @@ -41,14 +41,8 @@ public class CommunicationTestEnvironment : TestEnvironment

public bool ShouldIgnorePhoneNumbersTests => bool.Parse(SkipPhoneNumbersTest);

public string AzureTestAgent => GetOptionalVariable(AzureTestAgentVariableName);
public string TestAgentPhoneNumber => GetRecordedVariable($"{AzurePhoneNumber}_{AzureTestAgent}", options => options.IsSecret("+14255550123"));

private string? GetPhoneNumberByTestAgent()
{
if (AzureTestAgent == null)
return null;

return GetRecordedOptionalVariable($"{AzurePhoneNumber}_{AzureTestAgent}", options => options.IsSecret("+14255550123"));
}
private string AzureTestAgent => GetVariable(AzureTestAgentVariableName);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,21 @@
"OSVmImage": "macOS-10.15",
"Pool": "Azure Pipelines",
"TestTargetFramework": "netcoreapp3.1",
"AZURE_PHONE_NUMBER_ID": "2",
"SKIP_UPDATE_CAPABILITIES_LIVE_TESTS": "FALSE"
"SKIP_UPDATE_CAPABILITIES_LIVE_TESTS": "TRUE"
},
"macOS-10.15_NET6.0": {
"OSVmImage": "macOS-10.15",
"Pool": "Azure Pipelines",
"TestTargetFramework": "net6.0",
"AZURE_TEST_AGENT": "macos_1015_net60"
"AZURE_TEST_AGENT": "macos_1015_net60",
"SKIP_UPDATE_CAPABILITIES_LIVE_TESTS": "FALSE"
}
},
"AdditionalTestArguments": [
"/p:UseProjectReferenceToAzureClients=false",
"/p:UseProjectReferenceToAzureClients=true"
],
"BuildConfiguration": [
"Debug",
"Release"
]
"BuildConfiguration": ["Debug", "Release"]
},
"include": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,13 @@ protected PhoneNumbersClient CreateClient(AuthMethod authMethod = AuthMethod.Con

protected string GetTestPhoneNumber()
{
return TestEnvironment.Mode == RecordedTestMode.Playback
? RecordedTestSanitizer.SanitizeValue
: TestEnvironment.CommunicationTestPhoneNumber;
if (TestEnvironment.Mode == RecordedTestMode.Playback)
return RecordedTestSanitizer.SanitizeValue;

if (!SkipUpdateCapabilitiesLiveTest)
return TestEnvironment.TestAgentPhoneNumber;

return TestEnvironment.DefaultTestPhoneNumber;
}

protected void SleepIfNotInPlaybackMode()
Expand Down

0 comments on commit 8545cde

Please sign in to comment.