Skip to content

Commit

Permalink
[Communication] - phone-numbers - Implement a phone number pool for u…
Browse files Browse the repository at this point in the history
…pdate capabilities live tests (Azure#23116)

* Use phone number pool in update capabilities tests

* Fix env variable name in pipeline config file
  • Loading branch information
danielortega-msft authored and rakshith91 committed Apr 10, 2022
1 parent 2a8e693 commit eb3b63f
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"displayNames": {
"--disablecov": "",
"false": "",
"true": ""
},
"matrix": {
"Agent": {
"ubuntu-20.04": {
"OSVmImage": "MMSUbuntu20.04",
"Pool": "azsdk-pool-mms-ubuntu-2004-general",
"COMMUNICATION_SKIP_CAPABILITIES_LIVE_TEST": "true"
},
"windows-2019": {
"OSVmImage": "MMS2019",
"Pool": "azsdk-pool-mms-win-2019-general",
"AZURE_TEST_AGENT": "windows_2019_python36",
"COMMUNICATION_SKIP_CAPABILITIES_LIVE_TEST": "false"
},
"macOS-10.15": {
"OSVmImage": "macOS-10.15",
"Pool": "Azure Pipelines",
"AZURE_TEST_AGENT": "macos_1015_python37",
"COMMUNICATION_SKIP_CAPABILITIES_LIVE_TEST": "false"
}
},
"PythonVersion": ["pypy3.7", "3.6", "3.7", "3.8"],
"CoverageArg": "--disablecov",
"TestSamples": "false"
},
"include": [
{
"CoverageConfig": {
"ubuntu2004_39_coverage": {
"OSVmImage": "MMSUbuntu20.04",
"Pool": "azsdk-pool-mms-ubuntu-2004-general",
"PythonVersion": "3.9",
"CoverageArg": "",
"TestSamples": "false",
"AZURE_TEST_AGENT": "ubuntu_2004_python39",
"COMMUNICATION_SKIP_CAPABILITIES_LIVE_TEST": "false"
}
}
},
{
"Config": {
"Ubuntu2004_310": {
"OSVmImage": "MMSUbuntu20.04",
"Pool": "azsdk-pool-mms-ubuntu-2004-general",
"PythonVersion": "3.10.0",
"CoverageArg": "--disablecov",
"TestSamples": "false",
"COMMUNICATION_SKIP_CAPABILITIES_LIVE_TEST": "true"
}
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@
INT_PHONE_NUMBER_TEST_SKIP_REASON = "Phone numbers setting SMS capability does not support in INT. Skip these tests in INT."

SKIP_UPDATE_CAPABILITIES_TESTS = os.getenv("COMMUNICATION_SKIP_CAPABILITIES_LIVE_TEST", "false") == "true"
SKIP_UPDATE_CAPABILITIES_TESTS_REASON = "Phone number capabilities update does not currently support parallel execution. Skip these tests from live test pipeline."
SKIP_UPDATE_CAPABILITIES_TESTS_REASON = "Phone number capabilities are skipped."

def get_test_phone_number():
if SKIP_UPDATE_CAPABILITIES_TESTS:
return os.getenv("AZURE_PHONE_NUMBER")

test_agent = os.getenv("AZURE_TEST_AGENT")
return os.getenv("AZURE_PHONE_NUMBER_" + test_agent)

class PhoneNumbersClientTest(CommunicationTestCase):
def setUp(self):
Expand All @@ -32,7 +39,7 @@ def setUp(self):
self.phone_number = "sanitized"
self.country_code = "US"
else:
self.phone_number = os.getenv("AZURE_PHONE_NUMBER")
self.phone_number = get_test_phone_number()
self.country_code = os.getenv("AZURE_COMMUNICATION_SERVICE_COUNTRY_CODE", "US")
self.phone_number_client = PhoneNumbersClient.from_connection_string(
self.connection_str,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,14 @@
INT_PHONE_NUMBER_TEST_SKIP_REASON = "Phone numbers setting SMS capability does not support in INT. Skip these tests in INT."

SKIP_UPDATE_CAPABILITIES_TESTS = os.getenv("COMMUNICATION_SKIP_CAPABILITIES_LIVE_TEST", "false") == "true"
SKIP_UPDATE_CAPABILITIES_TESTS_REASON = "Phone number capabilities update does not currently support parallel execution. Skip these tests from live test pipeline."
SKIP_UPDATE_CAPABILITIES_TESTS_REASON = "Phone number capabilities are skipped."

def get_test_phone_number():
if SKIP_UPDATE_CAPABILITIES_TESTS:
return os.getenv("AZURE_PHONE_NUMBER")

test_agent = os.getenv("AZURE_TEST_AGENT")
return os.getenv("AZURE_PHONE_NUMBER_" + test_agent)

class PhoneNumbersClientTestAsync(AsyncCommunicationTestCase):
def setUp(self):
Expand All @@ -33,7 +40,7 @@ def setUp(self):
self.phone_number = "sanitized"
self.country_code = "US"
else:
self.phone_number = os.getenv("AZURE_PHONE_NUMBER")
self.phone_number = get_test_phone_number()
self.country_code = os.getenv("AZURE_COMMUNICATION_SERVICE_COUNTRY_CODE", "US")
self.phone_number_client = PhoneNumbersClient.from_connection_string(
self.connection_str,
Expand Down
17 changes: 11 additions & 6 deletions sdk/communication/azure-communication-phonenumbers/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ trigger: none
stages:
- template: /eng/pipelines/templates/stages/archetype-sdk-tests.yml
parameters:
BuildTargetingString: 'azure-communication-phonenumbers'
BuildTargetingString: "azure-communication-phonenumbers"
JobName: phonenumbers
ServiceDirectory: communication
CloudConfig:
Expand All @@ -15,9 +15,14 @@ stages:
MatrixReplace:
- TestSamples=.*/true
Int:
SubscriptionConfigurations:
- $(sub-config-communication-int-test-resources-common)
- $(sub-config-communication-int-test-resources-python)
SubscriptionConfigurations:
- $(sub-config-communication-int-test-resources-common)
- $(sub-config-communication-int-test-resources-python)
MatrixReplace:
- COMMUNICATION_SKIP_CAPABILITIES_LIVE_TEST=false/true
Clouds: Public,Int
EnvVars:
COMMUNICATION_SKIP_CAPABILITIES_LIVE_TEST: true
MatrixConfigs:
- Name: PhoneNumbers_python_livetest_matrix
Path: sdk/communication/azure-communication-phonenumbers/phonenumbers-livetest-matrix.json
Selection: sparse
GenerateVMJobs: true

0 comments on commit eb3b63f

Please sign in to comment.