Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Communication] - phone-numbers - Implement a phone number pool for update capabilities live tests #23116

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
lucasrsant marked this conversation as resolved.
Show resolved Hide resolved

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