Skip to content

Commit b7813b9

Browse files
[Communication] - phone-numbers - Implement a phone number pool for update capabilities live tests (Azure#23116)
* Use phone number pool in update capabilities tests * Fix env variable name in pipeline config file
1 parent 73c03cc commit b7813b9

File tree

4 files changed

+87
-10
lines changed

4 files changed

+87
-10
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"displayNames": {
3+
"--disablecov": "",
4+
"false": "",
5+
"true": ""
6+
},
7+
"matrix": {
8+
"Agent": {
9+
"ubuntu-20.04": {
10+
"OSVmImage": "MMSUbuntu20.04",
11+
"Pool": "azsdk-pool-mms-ubuntu-2004-general",
12+
"COMMUNICATION_SKIP_CAPABILITIES_LIVE_TEST": "true"
13+
},
14+
"windows-2019": {
15+
"OSVmImage": "MMS2019",
16+
"Pool": "azsdk-pool-mms-win-2019-general",
17+
"AZURE_TEST_AGENT": "windows_2019_python36",
18+
"COMMUNICATION_SKIP_CAPABILITIES_LIVE_TEST": "false"
19+
},
20+
"macOS-10.15": {
21+
"OSVmImage": "macOS-10.15",
22+
"Pool": "Azure Pipelines",
23+
"AZURE_TEST_AGENT": "macos_1015_python37",
24+
"COMMUNICATION_SKIP_CAPABILITIES_LIVE_TEST": "false"
25+
}
26+
},
27+
"PythonVersion": ["pypy3.7", "3.6", "3.7", "3.8"],
28+
"CoverageArg": "--disablecov",
29+
"TestSamples": "false"
30+
},
31+
"include": [
32+
{
33+
"CoverageConfig": {
34+
"ubuntu2004_39_coverage": {
35+
"OSVmImage": "MMSUbuntu20.04",
36+
"Pool": "azsdk-pool-mms-ubuntu-2004-general",
37+
"PythonVersion": "3.9",
38+
"CoverageArg": "",
39+
"TestSamples": "false",
40+
"AZURE_TEST_AGENT": "ubuntu_2004_python39",
41+
"COMMUNICATION_SKIP_CAPABILITIES_LIVE_TEST": "false"
42+
}
43+
}
44+
},
45+
{
46+
"Config": {
47+
"Ubuntu2004_310": {
48+
"OSVmImage": "MMSUbuntu20.04",
49+
"Pool": "azsdk-pool-mms-ubuntu-2004-general",
50+
"PythonVersion": "3.10.0",
51+
"CoverageArg": "--disablecov",
52+
"TestSamples": "false",
53+
"COMMUNICATION_SKIP_CAPABILITIES_LIVE_TEST": "true"
54+
}
55+
}
56+
}
57+
]
58+
}

sdk/communication/azure-communication-phonenumbers/test/test_phone_number_administration_client.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,14 @@
2323
INT_PHONE_NUMBER_TEST_SKIP_REASON = "Phone numbers setting SMS capability does not support in INT. Skip these tests in INT."
2424

2525
SKIP_UPDATE_CAPABILITIES_TESTS = os.getenv("COMMUNICATION_SKIP_CAPABILITIES_LIVE_TEST", "false") == "true"
26-
SKIP_UPDATE_CAPABILITIES_TESTS_REASON = "Phone number capabilities update does not currently support parallel execution. Skip these tests from live test pipeline."
26+
SKIP_UPDATE_CAPABILITIES_TESTS_REASON = "Phone number capabilities are skipped."
27+
28+
def get_test_phone_number():
29+
if SKIP_UPDATE_CAPABILITIES_TESTS:
30+
return os.getenv("AZURE_PHONE_NUMBER")
31+
32+
test_agent = os.getenv("AZURE_TEST_AGENT")
33+
return os.getenv("AZURE_PHONE_NUMBER_" + test_agent)
2734

2835
class PhoneNumbersClientTest(CommunicationTestCase):
2936
def setUp(self):
@@ -32,7 +39,7 @@ def setUp(self):
3239
self.phone_number = "sanitized"
3340
self.country_code = "US"
3441
else:
35-
self.phone_number = os.getenv("AZURE_PHONE_NUMBER")
42+
self.phone_number = get_test_phone_number()
3643
self.country_code = os.getenv("AZURE_COMMUNICATION_SERVICE_COUNTRY_CODE", "US")
3744
self.phone_number_client = PhoneNumbersClient.from_connection_string(
3845
self.connection_str,

sdk/communication/azure-communication-phonenumbers/test/test_phone_number_administration_client_async.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,14 @@
2424
INT_PHONE_NUMBER_TEST_SKIP_REASON = "Phone numbers setting SMS capability does not support in INT. Skip these tests in INT."
2525

2626
SKIP_UPDATE_CAPABILITIES_TESTS = os.getenv("COMMUNICATION_SKIP_CAPABILITIES_LIVE_TEST", "false") == "true"
27-
SKIP_UPDATE_CAPABILITIES_TESTS_REASON = "Phone number capabilities update does not currently support parallel execution. Skip these tests from live test pipeline."
27+
SKIP_UPDATE_CAPABILITIES_TESTS_REASON = "Phone number capabilities are skipped."
28+
29+
def get_test_phone_number():
30+
if SKIP_UPDATE_CAPABILITIES_TESTS:
31+
return os.getenv("AZURE_PHONE_NUMBER")
32+
33+
test_agent = os.getenv("AZURE_TEST_AGENT")
34+
return os.getenv("AZURE_PHONE_NUMBER_" + test_agent)
2835

2936
class PhoneNumbersClientTestAsync(AsyncCommunicationTestCase):
3037
def setUp(self):
@@ -33,7 +40,7 @@ def setUp(self):
3340
self.phone_number = "sanitized"
3441
self.country_code = "US"
3542
else:
36-
self.phone_number = os.getenv("AZURE_PHONE_NUMBER")
43+
self.phone_number = get_test_phone_number()
3744
self.country_code = os.getenv("AZURE_COMMUNICATION_SERVICE_COUNTRY_CODE", "US")
3845
self.phone_number_client = PhoneNumbersClient.from_connection_string(
3946
self.connection_str,

sdk/communication/azure-communication-phonenumbers/tests.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ trigger: none
33
stages:
44
- template: /eng/pipelines/templates/stages/archetype-sdk-tests.yml
55
parameters:
6-
BuildTargetingString: 'azure-communication-phonenumbers'
6+
BuildTargetingString: "azure-communication-phonenumbers"
77
JobName: phonenumbers
88
ServiceDirectory: communication
99
CloudConfig:
@@ -15,9 +15,14 @@ stages:
1515
MatrixReplace:
1616
- TestSamples=.*/true
1717
Int:
18-
SubscriptionConfigurations:
19-
- $(sub-config-communication-int-test-resources-common)
20-
- $(sub-config-communication-int-test-resources-python)
18+
SubscriptionConfigurations:
19+
- $(sub-config-communication-int-test-resources-common)
20+
- $(sub-config-communication-int-test-resources-python)
21+
MatrixReplace:
22+
- COMMUNICATION_SKIP_CAPABILITIES_LIVE_TEST=false/true
2123
Clouds: Public,Int
22-
EnvVars:
23-
COMMUNICATION_SKIP_CAPABILITIES_LIVE_TEST: true
24+
MatrixConfigs:
25+
- Name: PhoneNumbers_python_livetest_matrix
26+
Path: sdk/communication/azure-communication-phonenumbers/phonenumbers-livetest-matrix.json
27+
Selection: sparse
28+
GenerateVMJobs: true

0 commit comments

Comments
 (0)