Skip to content

Commit

Permalink
Enable INT live test (Azure#18585)
Browse files Browse the repository at this point in the history
Add Prod and INT live tests
Skip Samples in phone number and sms in INT
Skip SMS test cases in INT
Skip update phone number with SMS capability tests cases in INT
  • Loading branch information
sacheun authored May 21, 2021
1 parent 46e6b2b commit b5f3794
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 8 deletions.
6 changes: 5 additions & 1 deletion sdk/communication/azure-communication-chat/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@ stages:
- $(sub-config-azure-cloud-test-resources)
- $(sub-config-communication-services-cloud-test-resources-common)
- $(sub-config-communication-services-cloud-test-resources-python)
Clouds: Public
Int:
SubscriptionConfigurations:
- $(sub-config-communication-int-test-resources-common)
- $(sub-config-communication-int-test-resources-python)
Clouds: Public,Int
6 changes: 5 additions & 1 deletion sdk/communication/azure-communication-identity/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@ stages:
- $(sub-config-azure-cloud-test-resources)
- $(sub-config-communication-services-cloud-test-resources-common)
- $(sub-config-communication-services-cloud-test-resources-python)
Clouds: Public
Int:
SubscriptionConfigurations:
- $(sub-config-communication-int-test-resources-common)
- $(sub-config-communication-int-test-resources-python)
Clouds: Public,Int
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
SKIP_PURCHASE_PHONE_NUMBER_TESTS = True
PURCHASE_PHONE_NUMBER_TEST_SKIP_REASON = "Phone numbers shouldn't be purchased in live tests"

SKIP_INT_PHONE_NUMBER_TESTS = os.getenv("COMMUNICATION_SKIP_INT_PHONENUMBERS_TEST", "false") == "true"
INT_PHONE_NUMBER_TEST_SKIP_REASON = "Phone numbers setting SMS capability does not support in INT. Skip these tests in INT."

class PhoneNumbersClientTest(CommunicationTestCase):
def setUp(self):
Expand Down Expand Up @@ -70,6 +72,7 @@ def test_get_purchased_phone_number(self):
phone_number = self.phone_number_client.get_purchased_phone_number(self.phone_number)
assert phone_number.phone_number == self.phone_number

@pytest.mark.skipif(SKIP_INT_PHONE_NUMBER_TESTS, reason=INT_PHONE_NUMBER_TEST_SKIP_REASON)
def test_search_available_phone_numbers_from_managed_identity(self):
endpoint, access_key = parse_connection_str(self.connection_str)
credential = create_token_credential()
Expand All @@ -91,6 +94,7 @@ def test_search_available_phone_numbers_from_managed_identity(self):
)
assert poller.result()

@pytest.mark.skipif(SKIP_INT_PHONE_NUMBER_TESTS, reason=INT_PHONE_NUMBER_TEST_SKIP_REASON)
def test_search_available_phone_numbers(self):
capabilities = PhoneNumberCapabilities(
calling = PhoneNumberCapabilityType.INBOUND,
Expand All @@ -105,6 +109,7 @@ def test_search_available_phone_numbers(self):
)
assert poller.result()

@pytest.mark.skipif(SKIP_INT_PHONE_NUMBER_TESTS, reason=INT_PHONE_NUMBER_TEST_SKIP_REASON)
def test_update_phone_number_capabilities_from_managed_identity(self):
endpoint, access_key = parse_connection_str(self.connection_str)
credential = create_token_credential()
Expand All @@ -125,6 +130,7 @@ def test_update_phone_number_capabilities_from_managed_identity(self):
assert poller.result()
assert poller.status() == PhoneNumberOperationStatus.SUCCEEDED.value

@pytest.mark.skipif(SKIP_INT_PHONE_NUMBER_TESTS, reason=INT_PHONE_NUMBER_TEST_SKIP_REASON)
def test_update_phone_number_capabilities(self):
current_phone_number = self.phone_number_client.get_purchased_phone_number(self.phone_number)
calling_capabilities = PhoneNumberCapabilityType.INBOUND if current_phone_number.capabilities.calling == PhoneNumberCapabilityType.OUTBOUND else PhoneNumberCapabilityType.OUTBOUND
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
SKIP_PURCHASE_PHONE_NUMBER_TESTS = True
PURCHASE_PHONE_NUMBER_TEST_SKIP_REASON = "Phone numbers shouldn't be purchased in live tests"

SKIP_INT_PHONE_NUMBER_TESTS = os.getenv("COMMUNICATION_SKIP_INT_PHONENUMBERS_TEST", "false") == "true"
INT_PHONE_NUMBER_TEST_SKIP_REASON = "Phone numbers setting SMS capability does not support in INT. Skip these tests in INT."

class PhoneNumbersClientTestAsync(AsyncCommunicationTestCase):
def setUp(self):
Expand Down Expand Up @@ -85,6 +87,7 @@ async def test_get_purchased_phone_number(self):
phone_number = await self.phone_number_client.get_purchased_phone_number(self.phone_number)
assert phone_number.phone_number == self.phone_number

@pytest.mark.skipif(SKIP_INT_PHONE_NUMBER_TESTS, reason=INT_PHONE_NUMBER_TEST_SKIP_REASON)
@AsyncCommunicationTestCase.await_prepared_test
async def test_search_available_phone_numbers_from_managed_identity(self):
endpoint, access_key = parse_connection_str(self.connection_str)
Expand All @@ -108,6 +111,7 @@ async def test_search_available_phone_numbers_from_managed_identity(self):
)
assert poller.result()

@pytest.mark.skipif(SKIP_INT_PHONE_NUMBER_TESTS, reason=INT_PHONE_NUMBER_TEST_SKIP_REASON)
@AsyncCommunicationTestCase.await_prepared_test
async def test_search_available_phone_numbers(self):
capabilities = PhoneNumberCapabilities(
Expand All @@ -124,6 +128,7 @@ async def test_search_available_phone_numbers(self):
)
assert poller.result()

@pytest.mark.skipif(SKIP_INT_PHONE_NUMBER_TESTS, reason=INT_PHONE_NUMBER_TEST_SKIP_REASON)
@AsyncCommunicationTestCase.await_prepared_test
async def test_update_phone_number_capabilities(self):
async with self.phone_number_client:
Expand All @@ -139,6 +144,7 @@ async def test_update_phone_number_capabilities(self):
assert await poller.result()
assert poller.status() == PhoneNumberOperationStatus.SUCCEEDED.value

@pytest.mark.skipif(SKIP_INT_PHONE_NUMBER_TESTS, reason=INT_PHONE_NUMBER_TEST_SKIP_REASON)
@AsyncCommunicationTestCase.await_prepared_test
async def test_update_phone_number_capabilities_from_managed_identity(self):
endpoint, access_key = parse_connection_str(self.connection_str)
Expand Down
10 changes: 7 additions & 3 deletions sdk/communication/azure-communication-phonenumbers/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ stages:
JobName: phonenumbers
ServiceDirectory: communication
DeployArmTemplate: true
MatrixReplace:
- TestSamples=.*/true
CloudConfig:
Public:
SubscriptionConfigurations:
- $(sub-config-azure-cloud-test-resources)
- $(sub-config-communication-services-cloud-test-resources-common)
- $(sub-config-communication-services-cloud-test-resources-python)
Clouds: Public
MatrixReplace:
- TestSamples=.*/true
Int:
SubscriptionConfigurations:
- $(sub-config-communication-int-test-resources-common)
- $(sub-config-communication-int-test-resources-python)
Clouds: Public,Int
11 changes: 8 additions & 3 deletions sdk/communication/azure-communication-sms/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,17 @@ stages:
JobName: sms
ServiceDirectory: communication
DeployArmTemplate: true
MatrixReplace:
- TestSamples=.*/true
CloudConfig:
Public:
SubscriptionConfigurations:
- $(sub-config-azure-cloud-test-resources)
- $(sub-config-communication-services-cloud-test-resources-common)
- $(sub-config-communication-services-cloud-test-resources-python)
Clouds: Public
MatrixReplace:
- TestSamples=.*/true
Int:
SubscriptionConfigurations:
- $(sub-config-communication-int-test-resources-common)
- $(sub-config-communication-int-test-resources-python)
Clouds: Public,Int

Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,17 @@
from azure.identity import DefaultAzureCredential
from _shared.utils import get_http_logging_policy

SKIP_INT_SMS_TESTS = os.getenv("COMMUNICATION_SKIP_INT_SMS_TEST", "false") == "true"
INT_SMS_TEST_SKIP_REASON = "SMS does not support in INT. Skip these tests in INT."

class FakeTokenCredential(object):
def __init__(self):
self.token = AccessToken("Fake Token", 0)

def get_token(self, *args):
return self.token

@pytest.mark.skipif(SKIP_INT_SMS_TESTS, reason=INT_SMS_TEST_SKIP_REASON)
class SMSClientTest(CommunicationTestCase):
def __init__(self, method_name):
super(SMSClientTest, self).__init__(method_name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@
from azure.identity import DefaultAzureCredential
from _shared.utils import get_http_logging_policy

SKIP_INT_SMS_TESTS = os.getenv("COMMUNICATION_SKIP_INT_SMS_TEST", "false") == "true"
INT_SMS_TEST_SKIP_REASON = "SMS does not support in INT. Skip these tests in INT."

class FakeTokenCredential(object):
def __init__(self):
self.token = AccessToken("Fake Token", 0)

def get_token(self, *args):
return self.token

@pytest.mark.skipif(SKIP_INT_SMS_TESTS, reason=INT_SMS_TEST_SKIP_REASON)
class SMSClientTestAsync(AsyncCommunicationTestCase):
def __init__(self, method_name):
super(SMSClientTestAsync, self).__init__(method_name)
Expand Down

0 comments on commit b5f3794

Please sign in to comment.