Skip to content
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
Expand Up @@ -3,7 +3,7 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
from azure.cli.testsdk import ResourceGroupPreparer, JMESPathCheck
from azure.cli.testsdk import ScenarioTest
from azure.cli.testsdk import ScenarioTest, record_only
from .scenario_mixin import CdnScenarioMixin

from azure.mgmt.cdn.models import SkuName
Expand Down Expand Up @@ -70,6 +70,7 @@ def test_endpoint_crud(self, resource_group):

self.endpoint_delete_cmd(resource_group, endpoint_name, profile_name)

@record_only() # This test relies on existing resources in a specific subscription
@ResourceGroupPreparer()
def test_private_link(self, resource_group):
profile_name = 'profile123'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
from azure.cli.testsdk import ResourceGroupPreparer, ScenarioTest, JMESPathCheck
from azure.cli.testsdk import ResourceGroupPreparer, ScenarioTest, JMESPathCheck, record_only
from .scenario_mixin import CdnScenarioMixin


class CdnOriginScenarioTest(CdnScenarioMixin, ScenarioTest):

@record_only() # This tests relies on a specific subscription with existing resources
@ResourceGroupPreparer()
def test_origin_crud(self, resource_group):

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -947,9 +947,16 @@ def _test_PrivateDnsZone(self, zone_name, filename):
self.cmd('network private-dns zone export -g {rg} -n {zone} --file-name "{export}"')
self.cmd('network private-dns zone delete -g {rg} -n {zone} -y')
time.sleep(10)
for i in range(5):
try:
# Reimport zone file and verify both record sets are equivalent
self.cmd('network private-dns zone import -n {zone} -g {rg} --file-name "{export}"')
break
except:
if i == 4:
raise
time.sleep(10)

# Reimport zone file and verify both record sets are equivalent
self.cmd('network private-dns zone import -n {zone} -g {rg} --file-name "{export}"')
records2 = self.cmd('network private-dns record-set list -g {rg} -z {zone}').get_output_in_json()

# verify that each record in the original import is unchanged after export/re-import
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
from azure.cli.testsdk import ScenarioTest
from azure.cli.testsdk import ScenarioTest, record_only


class AzureReservationsTests(ScenarioTest):
Expand Down Expand Up @@ -33,6 +33,7 @@ def _validate_reservation(self, reservation):
self.assertTrue(reservation['type'])
self.assertTrue(reservation['type'] == 'Microsoft.Capacity/reservationOrders/reservations')

@record_only() # This test relies on a subscription id with the existing reservation orders
def test_get_applied_reservation_order_ids(self):
self.kwargs.update({
'subscription': '00000000-0000-0000-0000-000000000000'
Expand All @@ -42,6 +43,7 @@ def test_get_applied_reservation_order_ids(self):
for order_id in result['reservationOrderIds']['value']:
self.assertIn('/providers/Microsoft.Capacity/reservationorders/', order_id)

@record_only() # This test relies on the existing reservation order
def test_list_reservation_order(self):
reservation_order_list = self.cmd('reservations reservation-order list').get_output_in_json()
self.assertIsNotNone(reservation_order_list)
Expand All @@ -52,6 +54,7 @@ def test_list_reservation_order(self):
for reservation in order['reservations']:
self.assertTrue(reservation['id'])

@record_only() # This test relies on the existing reservation order
def test_get_reservation_order(self):
self.kwargs.update({
'reservation_order_id': '0a47417c-cd30-4f67-add6-d631583e09f3'
Expand All @@ -62,6 +65,7 @@ def test_get_reservation_order(self):
self.assertIn('/providers/microsoft.capacity/reservationOrders/', reservation_order['id'])
self.assertGreater(reservation_order['etag'], 0)

@record_only() # This test relies on the existing reservation order
def test_list_reservation(self):
self.kwargs.update({
'reservation_order_id': '0a47417c-cd30-4f67-add6-d631583e09f3'
Expand All @@ -74,6 +78,7 @@ def test_list_reservation(self):
self.assertGreater(reservation['etag'], 0)
self.assertEqual('Microsoft.Capacity/reservationOrders/reservations', reservation['type'])

@record_only() # This test relies on the existing reservation order
def test_get_reservation(self):
self.kwargs.update({
'reservation_order_id': '0a47417c-cd30-4f67-add6-d631583e09f3',
Expand All @@ -86,6 +91,7 @@ def test_get_reservation(self):
self.assertGreater(reservation['properties']['quantity'], 0)
self.assertEqual('Microsoft.Capacity/reservationOrders/reservations', reservation['type'])

@record_only() # This test relies on the existing reservation order
def test_list_reservation_history(self):
self.kwargs.update({
'reservation_order_id': '0a47417c-cd30-4f67-add6-d631583e09f3',
Expand All @@ -99,6 +105,7 @@ def test_list_reservation_history(self):
name_format = '{}/{}'.format(self.kwargs['reservation_order_id'], self.kwargs['reservation_id'])
self.assertIn(name_format, entry['name'])

@record_only() # This test relies on a subscription with reservation permissions
def test_get_catalog(self):
self.kwargs.update({
'subscription': '00000000-0000-0000-0000-000000000000',
Expand All @@ -114,6 +121,7 @@ def test_get_catalog(self):
self.assertIsNotNone(entry['resourceType'])
self.assertIsNotNone(entry['name'])

@record_only() # This test relies on the existing reservation order
def test_update_reservation(self):
self.kwargs.update({
'reservation_order_id': 'fe1341ea-4820-4ac9-9352-4136a6d8a252',
Expand All @@ -132,6 +140,7 @@ def test_update_reservation(self):
' --instance-flexibility {instance_flexibility}').get_output_in_json()
self.assertEqual('Shared', shared_reservation['properties']['appliedScopeType'])

@record_only() # This test relies on the existing reservation order
def test_split_and_merge(self):
self.kwargs.update({
'reservation_order_id': '0af601f3-7868-44ee-b833-4d2e64ad3d70',
Expand Down Expand Up @@ -171,6 +180,7 @@ def test_split_and_merge(self):
if 'Succeeded' in item['properties']['provisioningState']:
self.assertEqual(quantity_sum, item['properties']['quantity'])

@record_only() # This test relies on a subscription with reservation permissions
def test_calculate_reservation_order(self):
self.kwargs.update({
'subid': 'd3ae48e5-dbb2-4618-afd4-fb1b8559cb80',
Expand All @@ -192,6 +202,7 @@ def test_calculate_reservation_order(self):
self.assertIsNotNone(response['properties']['reservationOrderId'])
self.assertEqual('standard_b1ls', response['properties']['skuDescription'])

@record_only() # This test relies on a subscription with reservation purchase permissions
def test_purchase_reservation_order(self):
self.kwargs.update({
'roid': 'd4ef7ec2-941c-4da7-8ec9-2f148255a0dc',
Expand Down