From bf26607409571c3f47a653559469e08463b2a240 Mon Sep 17 00:00:00 2001 From: Swathi Pillalamarri Date: Mon, 25 Jan 2021 15:00:21 -0500 Subject: [PATCH 1/6] tests.yml - sample live test changes --- sdk/servicebus/test-resources.json | 104 +++++++++++++++++++++++++++++ sdk/servicebus/tests.yml | 2 + 2 files changed, 106 insertions(+) create mode 100644 sdk/servicebus/test-resources.json diff --git a/sdk/servicebus/test-resources.json b/sdk/servicebus/test-resources.json new file mode 100644 index 000000000000..fb5edf6ae74f --- /dev/null +++ b/sdk/servicebus/test-resources.json @@ -0,0 +1,104 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "baseName": { + "type": "string", + "defaultValue": "[resourceGroup().name]", + "metadata": { + "description": "The base resource name." + } + }, + "subscriptionId": { + "type": "string", + "defaultValue": "[subscription().subscriptionId]", + "metadata": { + "description": "The subscription ID to which the application and resources belong." + } + }, + "tenantId": { + "type": "string", + "defaultValue": "[subscription().tenantId]", + "metadata": { + "description": "The tenant ID to which the application and resources belong." + } + }, + "testApplicationOid": { + "type": "string", + "metadata": { + "description": "The client OID to grant access to test resources." + } + }, + "testApplicationId": { + "type": "string", + "metadata": { + "description": "The application client ID used to run tests." + } + }, + "testApplicationSecret": { + "type": "string", + "metadata": { + "description": "The application client secret used to run tests." + } + }, + "location": { + "type": "string", + "defaultValue": "[resourceGroup().location]", + "metadata": { + "description": "The location of the resources. By default, this is the same as the resource group." + } + } + }, + "variables": { + "serviceBusNamespace": "[concat('sb-', parameters('baseName'))]", + "defaultSASKeyName": "RootManageSharedAccessKey", + "authRuleResourceId": "[resourceId('Microsoft.ServiceBus/namespaces/authorizationRules', variables('serviceBusNamespace'), variables('defaultSASKeyName'))]", + "sbVersion": "2017-04-01", + "contributorRoleId": "b24988ac-6180-42a0-ab88-20f7382dd24c", + "serviceBusDataOwnerRoleId": "090c5cfd-751d-490a-894a-3ce6f1109419" + }, + "resources": [ + { + "apiVersion": "[variables('sbVersion')]", + "name": "[variables('serviceBusNamespace')]", + "type": "Microsoft.ServiceBus/Namespaces", + "location": "[parameters('location')]", + "sku": { + "name": "Standard" + }, + "properties": {} + }, + { + "type": "Microsoft.Authorization/roleAssignments", + "apiVersion": "2019-04-01-preview", + "name": "[guid(resourceGroup().id, parameters('testApplicationOid'), variables('serviceBusDataOwnerRoleId'))]", + "dependsOn": [ + "[resourceId('Microsoft.ServiceBus/Namespaces', variables('serviceBusNamespace'))]" + ], + "properties": { + "roleDefinitionId": "[resourceId('Microsoft.Authorization/roleDefinitions', variables('serviceBusDataOwnerRoleId'))]", + "principalId": "[parameters('testApplicationOid')]", + "scope": "[resourceGroup().id]" + } + }, + { + "type": "Microsoft.Authorization/roleAssignments", + "apiVersion": "2019-04-01-preview", + "name": "[guid(resourceGroup().id, parameters('testApplicationOid'), variables('contributorRoleId'))]", + "dependsOn": [ + "[resourceId('Microsoft.ServiceBus/Namespaces', variables('serviceBusNamespace'))]" + ], + "properties": { + "roleDefinitionId": "[resourceId('Microsoft.Authorization/roleDefinitions', variables('contributorRoleId'))]", + "principalId": "[parameters('testApplicationOid')]", + "scope": "[resourceGroup().id]" + } + } + ], + "outputs": { + "SERVICEBUS_CONNECTION_STRING": { + "type": "string", + "value": "[listkeys(variables('authRuleResourceId'), variables('sbVersion')).primaryConnectionString]" + } + } +} \ No newline at end of file diff --git a/sdk/servicebus/tests.yml b/sdk/servicebus/tests.yml index 71ed728bf9c3..cdb4cdee9634 100644 --- a/sdk/servicebus/tests.yml +++ b/sdk/servicebus/tests.yml @@ -5,6 +5,8 @@ jobs: parameters: ServiceDirectory: servicebus TestTimeoutInMinutes: 300 + DeployArmTemplate: true + TestSamples: true BuildTargetingString: azure-servicebus* EnvVars: AZURE_SUBSCRIPTION_ID: $(azure-subscription-id) From 6b07a338f67f26f3d416d0c6a044b268144b9e0b Mon Sep 17 00:00:00 2001 From: Swathi Pillalamarri Date: Thu, 28 Jan 2021 14:09:14 -0500 Subject: [PATCH 2/6] update arm template + samples for sb --- scripts/devops_tasks/test_run_samples.py | 6 +- .../samples/sync_samples/mgmt_rule.py | 4 +- .../samples/sync_samples/mgmt_subscription.py | 2 +- .../sync_samples/sample_code_servicebus.py | 2 +- sdk/servicebus/test-resources.json | 122 +++++++++++++++++- 5 files changed, 130 insertions(+), 6 deletions(-) diff --git a/scripts/devops_tasks/test_run_samples.py b/scripts/devops_tasks/test_run_samples.py index c7d1bb7cdbc5..ae724bdc8961 100644 --- a/scripts/devops_tasks/test_run_samples.py +++ b/scripts/devops_tasks/test_run_samples.py @@ -25,7 +25,11 @@ "__init__.py", "consume_cloud_events_from_eventhub.py", "consume_cloud_events_from_service_bus_queue.py", - "consume_cloud_events_from_storage_queue.py"] + "consume_cloud_events_from_storage_queue.py"], + "azure-servicebus": [ + "proxy.py", + "proxy_async.py" + ] } diff --git a/sdk/servicebus/azure-servicebus/samples/sync_samples/mgmt_rule.py b/sdk/servicebus/azure-servicebus/samples/sync_samples/mgmt_rule.py index c0bbce6b5c89..eeb7ac6a4032 100644 --- a/sdk/servicebus/azure-servicebus/samples/sync_samples/mgmt_rule.py +++ b/sdk/servicebus/azure-servicebus/samples/sync_samples/mgmt_rule.py @@ -20,8 +20,8 @@ from azure.servicebus.management import ServiceBusAdministrationClient CONNECTION_STR = os.environ['SERVICE_BUS_CONNECTION_STR'] -TOPIC_NAME = "sb_mgmt_demo_topic" -SUBSCRIPTION_NAME = "sb_mgmt_demo_subscription" +TOPIC_NAME = os.environ['SERVICE_BUS_TOPIC_NAME'] +SUBSCRIPTION_NAME = os.environ['SERVICE_BUS_SUBSCRIPTION_NAME'] RULE_NAME = "sb_mgmt_demo_rule" diff --git a/sdk/servicebus/azure-servicebus/samples/sync_samples/mgmt_subscription.py b/sdk/servicebus/azure-servicebus/samples/sync_samples/mgmt_subscription.py index a03079f9423d..afec2b34bb27 100644 --- a/sdk/servicebus/azure-servicebus/samples/sync_samples/mgmt_subscription.py +++ b/sdk/servicebus/azure-servicebus/samples/sync_samples/mgmt_subscription.py @@ -20,7 +20,7 @@ from azure.servicebus.management import ServiceBusAdministrationClient CONNECTION_STR = os.environ['SERVICE_BUS_CONNECTION_STR'] -TOPIC_NAME = "sb_mgmt_demo_topic" +TOPIC_NAME = os.environ['SERVICE_BUS_TOPIC_NAME'] SUBSCRIPTION_NAME = "sb_mgmt_demo_subscription" diff --git a/sdk/servicebus/azure-servicebus/samples/sync_samples/sample_code_servicebus.py b/sdk/servicebus/azure-servicebus/samples/sync_samples/sample_code_servicebus.py index 7ef9de246acd..5482e6c164d2 100644 --- a/sdk/servicebus/azure-servicebus/samples/sync_samples/sample_code_servicebus.py +++ b/sdk/servicebus/azure-servicebus/samples/sync_samples/sample_code_servicebus.py @@ -313,7 +313,7 @@ def example_receive_deadletter_sync(): def example_session_ops_sync(): servicebus_connection_str = os.environ['SERVICE_BUS_CONNECTION_STR'] queue_name = os.environ['SERVICE_BUS_SESSION_QUEUE_NAME'] - session_id = "" + session_id = os.environ['SERVICE_BUS_SESSION_ID'] with ServiceBusClient.from_connection_string(conn_str=servicebus_connection_str) as servicebus_client: diff --git a/sdk/servicebus/test-resources.json b/sdk/servicebus/test-resources.json index fb5edf6ae74f..86db2120fefe 100644 --- a/sdk/servicebus/test-resources.json +++ b/sdk/servicebus/test-resources.json @@ -51,6 +51,12 @@ }, "variables": { "serviceBusNamespace": "[concat('sb-', parameters('baseName'))]", + "serviceBusSubscriptionName": "[concat('sb-', parameters('baseName'), '-subscription')]", + "serviceBusTopicName": "[concat('sb-', parameters('baseName'), '-topic')]", + "serviceBusQueueName": "[concat('sb-', parameters('baseName'), '-queue')]", + "serviceBusSessionQueueName": "[concat('sb-', parameters('baseName'), '-session-queue')]", + "sessionQueueAuthorizationRuleName": "[concat('sb-', parameters('baseName'), '-session-queue-auth')]", + "serviceBusSessionId": "[concat('sb-', parameters('baseName'), '-session-queue-id')]", "defaultSASKeyName": "RootManageSharedAccessKey", "authRuleResourceId": "[resourceId('Microsoft.ServiceBus/namespaces/authorizationRules', variables('serviceBusNamespace'), variables('defaultSASKeyName'))]", "sbVersion": "2017-04-01", @@ -66,6 +72,83 @@ "sku": { "name": "Standard" }, + "resources": [ + { + "apiVersion": "[variables('sbVersion')]", + "name": "[variables('serviceBusTopicName')]", + "type": "Topics", + "dependsOn": [ + "[concat('Microsoft.ServiceBus/namespaces/', variables('serviceBusNamespace'))]" + ], + "properties": { + "path": "[variables('serviceBusTopicName')]" + }, + "resources": [{ + "apiVersion": "[variables('sbVersion')]", + "name": "[variables('serviceBusSubscriptionName')]", + "type": "Subscriptions", + "dependsOn": [ + "[variables('serviceBusTopicName')]" + ], + "properties": {} + }] + }, + { + "type": "Queues", + "apiVersion": "[variables('sbVersion')]", + "name": "[variables('serviceBusQueueName')]", + "dependsOn": [ + "[resourceId('Microsoft.ServiceBus/namespaces', variables('serviceBusNamespace'))]" + ], + "properties": { + "lockDuration": "PT5M", + "maxSizeInMegabytes": 1024, + "requiresDuplicateDetection": false, + "requiresSession": false, + "defaultMessageTimeToLive": "P10675199DT2H48M5.4775807S", + "deadLetteringOnMessageExpiration": false, + "duplicateDetectionHistoryTimeWindow": "PT10M", + "maxDeliveryCount": 10, + "autoDeleteOnIdle": "P10675199DT2H48M5.4775807S", + "enablePartitioning": false, + "enableExpress": false + } + }, + { + "type": "Queues", + "apiVersion": "[variables('sbVersion')]", + "name": "[variables('serviceBusSessionQueueName')]", + "dependsOn": [ + "[resourceId('Microsoft.ServiceBus/namespaces', variables('serviceBusNamespace'))]" + ], + "properties": { + "lockDuration": "PT5M", + "maxSizeInMegabytes": 1024, + "requiresDuplicateDetection": false, + "requiresSession": true, + "defaultMessageTimeToLive": "P10675199DT2H48M5.4775807S", + "deadLetteringOnMessageExpiration": false, + "duplicateDetectionHistoryTimeWindow": "PT10M", + "maxDeliveryCount": 10, + "autoDeleteOnIdle": "P10675199DT2H48M5.4775807S", + "enablePartitioning": false, + "enableExpress": false + }, + "resources": [ + { + "apiVersion": "[variables('sbVersion')]", + "name": "[variables('sessionQueueAuthorizationRuleName')]", + "type": "authorizationRules", + "dependsOn": [ + "[variables('serviceBusSessionQueueName')]" + ], + "properties": { + "Rights": ["Manage", "Send", "Listen"] + } + } + ] + } + ], "properties": {} }, { @@ -96,9 +179,46 @@ } ], "outputs": { - "SERVICEBUS_CONNECTION_STRING": { + "SERVICE_BUS_CONNECTION_STR": { "type": "string", "value": "[listkeys(variables('authRuleResourceId'), variables('sbVersion')).primaryConnectionString]" + }, + "SERVICE_BUS_NAMESPACE": { + "type": "string", + "value": "[variables('serviceBusNamespace')]" + }, + "SERVICE_BUS_FULLY_QUALIFIED_NAMESPACE": { + "type": "string", + "value": "[concat(variables('serviceBusNamespace'), '.servicebus.windows.net')]" + }, + "SERVICE_BUS_TOPIC_NAME": { + "type": "string", + "value": "[variables('serviceBusTopicName')]" + }, + "SERVICE_BUS_SUBSCRIPTION_NAME": { + "type": "string", + "value": "[variables('serviceBusSubscriptionName')]" + }, + "SERVICE_BUS_QUEUE_NAME": { + "type": "string", + "value": "[variables('serviceBusQueueName')]" + }, + "SERVICE_BUS_SESSION_QUEUE_NAME": { + "type": "string", + "value": "[variables('serviceBusSessionQueueName')]" + }, + "SERVICE_BUS_SESSION_ID":{ + "type": "string", + "value": "[variables('serviceBusSessionId')]" + }, + "SERVICE_BUS_SAS_POLICY":{ + "type": "string", + "value": "[variables('sessionQueueAuthorizationRuleName')]" + }, + "SERVICE_BUS_SAS_KEY":{ + "type": "string", + "value": "[listkeys(variables('sessionQueueAuthorizationRuleName'), variables('sbVersion')).primaryKey]" } + } } \ No newline at end of file From fddaa52798bcdfac74d05e7ac8089fed241564e8 Mon Sep 17 00:00:00 2001 From: Swathi Pillalamarri Date: Mon, 1 Feb 2021 15:59:30 -0500 Subject: [PATCH 3/6] update env variables --- scripts/devops_tasks/test_run_samples.py | 7 ++++++- .../async_samples/client_identity_authentication_async.py | 2 +- .../samples/sync_samples/client_identity_authentication.py | 2 +- .../generate_sas_token_and_authenticate_client.py | 2 +- sdk/servicebus/test-resources.json | 4 ---- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/scripts/devops_tasks/test_run_samples.py b/scripts/devops_tasks/test_run_samples.py index ae724bdc8961..81b939d4a894 100644 --- a/scripts/devops_tasks/test_run_samples.py +++ b/scripts/devops_tasks/test_run_samples.py @@ -27,8 +27,13 @@ "consume_cloud_events_from_service_bus_queue.py", "consume_cloud_events_from_storage_queue.py"], "azure-servicebus": [ + "failure_and_recovery.py", "proxy.py", - "proxy_async.py" + "receive_iterator_queue.py", + "session_pool_receive.py", + "proxy_async.py", + "receive_iterator_queue_async.py" + "session_pool_receive_async.py" ] } diff --git a/sdk/servicebus/azure-servicebus/samples/async_samples/client_identity_authentication_async.py b/sdk/servicebus/azure-servicebus/samples/async_samples/client_identity_authentication_async.py index de8dd425f44c..f23bddedba97 100644 --- a/sdk/servicebus/azure-servicebus/samples/async_samples/client_identity_authentication_async.py +++ b/sdk/servicebus/azure-servicebus/samples/async_samples/client_identity_authentication_async.py @@ -39,7 +39,7 @@ from azure.identity.aio import EnvironmentCredential -FULLY_QUALIFIED_NAMESPACE = os.environ['SERVICE_BUS_NAMESPACE'] +FULLY_QUALIFIED_NAMESPACE = os.environ['SERVICE_BUS_FULLY_QUALIFIED_NAMESPACE'] QUEUE_NAME = os.environ["SERVICE_BUS_QUEUE_NAME"] diff --git a/sdk/servicebus/azure-servicebus/samples/sync_samples/client_identity_authentication.py b/sdk/servicebus/azure-servicebus/samples/sync_samples/client_identity_authentication.py index 126cb8df3f9c..ddf5856c59d0 100644 --- a/sdk/servicebus/azure-servicebus/samples/sync_samples/client_identity_authentication.py +++ b/sdk/servicebus/azure-servicebus/samples/sync_samples/client_identity_authentication.py @@ -40,7 +40,7 @@ from azure.identity import EnvironmentCredential -FULLY_QUALIFIED_NAMESPACE = os.environ['SERVICE_BUS_NAMESPACE'] +FULLY_QUALIFIED_NAMESPACE = os.environ['SERVICE_BUS_FULLY_QUALIFIED_NAMESPACE'] QUEUE_NAME = os.environ["SERVICE_BUS_QUEUE_NAME"] credential = EnvironmentCredential() diff --git a/sdk/servicebus/azure-servicebus/samples/sync_samples/generate_sas_token_and_authenticate_client.py b/sdk/servicebus/azure-servicebus/samples/sync_samples/generate_sas_token_and_authenticate_client.py index 16a42804d515..bfcb9c9a7d19 100644 --- a/sdk/servicebus/azure-servicebus/samples/sync_samples/generate_sas_token_and_authenticate_client.py +++ b/sdk/servicebus/azure-servicebus/samples/sync_samples/generate_sas_token_and_authenticate_client.py @@ -46,7 +46,7 @@ def get_token(self, *scopes, **kwargs): """ return AccessToken(self.token, self.expiry) -FULLY_QUALIFIED_NAMESPACE = os.environ['SERVICE_BUS_NAMESPACE'] +FULLY_QUALIFIED_NAMESPACE = os.environ['SERVICE_BUS_FULLY_QUALIFIED_NAMESPACE'] SESSION_QUEUE_NAME = os.environ["SERVICE_BUS_SESSION_QUEUE_NAME"] SAS_POLICY = os.environ['SERVICE_BUS_SAS_POLICY'] SAS_KEY = os.environ['SERVICE_BUS_SAS_KEY'] diff --git a/sdk/servicebus/test-resources.json b/sdk/servicebus/test-resources.json index 86db2120fefe..afaffc50f182 100644 --- a/sdk/servicebus/test-resources.json +++ b/sdk/servicebus/test-resources.json @@ -183,10 +183,6 @@ "type": "string", "value": "[listkeys(variables('authRuleResourceId'), variables('sbVersion')).primaryConnectionString]" }, - "SERVICE_BUS_NAMESPACE": { - "type": "string", - "value": "[variables('serviceBusNamespace')]" - }, "SERVICE_BUS_FULLY_QUALIFIED_NAMESPACE": { "type": "string", "value": "[concat(variables('serviceBusNamespace'), '.servicebus.windows.net')]" From ce61e7f41f47de62eeff3f2a2ab0f55ce1f89e29 Mon Sep 17 00:00:00 2001 From: Swathi Pillalamarri Date: Tue, 2 Feb 2021 14:41:26 -0500 Subject: [PATCH 4/6] update mgmt sample resource names to avoid conflict --- scripts/devops_tasks/test_run_samples.py | 2 +- .../samples/async_samples/mgmt_queue_async.py | 2 +- .../samples/async_samples/mgmt_rule_async.py | 6 +++--- .../samples/async_samples/mgmt_subscription_async.py | 4 ++-- .../samples/async_samples/mgmt_topic_async.py | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/devops_tasks/test_run_samples.py b/scripts/devops_tasks/test_run_samples.py index 81b939d4a894..947872c3b944 100644 --- a/scripts/devops_tasks/test_run_samples.py +++ b/scripts/devops_tasks/test_run_samples.py @@ -32,7 +32,7 @@ "receive_iterator_queue.py", "session_pool_receive.py", "proxy_async.py", - "receive_iterator_queue_async.py" + "receive_iterator_queue_async.py", "session_pool_receive_async.py" ] } diff --git a/sdk/servicebus/azure-servicebus/samples/async_samples/mgmt_queue_async.py b/sdk/servicebus/azure-servicebus/samples/async_samples/mgmt_queue_async.py index f6544b1cba02..f3585057336e 100644 --- a/sdk/servicebus/azure-servicebus/samples/async_samples/mgmt_queue_async.py +++ b/sdk/servicebus/azure-servicebus/samples/async_samples/mgmt_queue_async.py @@ -21,7 +21,7 @@ from azure.servicebus.aio.management import ServiceBusAdministrationClient CONNECTION_STR = os.environ['SERVICE_BUS_CONNECTION_STR'] -QUEUE_NAME = "sb_mgmt_demo_queue" +QUEUE_NAME = "sb_mgmt_demo_queue_async" async def create_queue(servicebus_mgmt_client): diff --git a/sdk/servicebus/azure-servicebus/samples/async_samples/mgmt_rule_async.py b/sdk/servicebus/azure-servicebus/samples/async_samples/mgmt_rule_async.py index 0aa66e21d06c..f30403fc6e3a 100644 --- a/sdk/servicebus/azure-servicebus/samples/async_samples/mgmt_rule_async.py +++ b/sdk/servicebus/azure-servicebus/samples/async_samples/mgmt_rule_async.py @@ -21,9 +21,9 @@ from azure.servicebus.aio.management import ServiceBusAdministrationClient CONNECTION_STR = os.environ['SERVICE_BUS_CONNECTION_STR'] -TOPIC_NAME = "sb_mgmt_demo_topic" -SUBSCRIPTION_NAME = "sb_mgmt_demo_subscription" -RULE_NAME = "sb_mgmt_demo_rule" +TOPIC_NAME = os.environ['SERVICE_BUS_TOPIC_NAME'] +SUBSCRIPTION_NAME = os.environ['SERVICE_BUS_SUBSCRIPTION_NAME'] +RULE_NAME = "sb_mgmt_demo_rule_async" async def create_rule(servicebus_mgmt_client): diff --git a/sdk/servicebus/azure-servicebus/samples/async_samples/mgmt_subscription_async.py b/sdk/servicebus/azure-servicebus/samples/async_samples/mgmt_subscription_async.py index d4cb4aa4146e..e3e0834bca8c 100644 --- a/sdk/servicebus/azure-servicebus/samples/async_samples/mgmt_subscription_async.py +++ b/sdk/servicebus/azure-servicebus/samples/async_samples/mgmt_subscription_async.py @@ -21,8 +21,8 @@ from azure.servicebus.aio.management import ServiceBusAdministrationClient CONNECTION_STR = os.environ['SERVICE_BUS_CONNECTION_STR'] -TOPIC_NAME = "sb_mgmt_demo_topic" -SUBSCRIPTION_NAME = "sb_mgmt_demo_subscription" +TOPIC_NAME = os.environ['SERVICE_BUS_TOPIC_NAME'] +SUBSCRIPTION_NAME = "sb_mgmt_demo_subscription_async" async def create_subscription(servicebus_mgmt_client): diff --git a/sdk/servicebus/azure-servicebus/samples/async_samples/mgmt_topic_async.py b/sdk/servicebus/azure-servicebus/samples/async_samples/mgmt_topic_async.py index 3b34a4e26eb4..0a02449f616e 100644 --- a/sdk/servicebus/azure-servicebus/samples/async_samples/mgmt_topic_async.py +++ b/sdk/servicebus/azure-servicebus/samples/async_samples/mgmt_topic_async.py @@ -21,7 +21,7 @@ from azure.servicebus.aio.management import ServiceBusAdministrationClient CONNECTION_STR = os.environ['SERVICE_BUS_CONNECTION_STR'] -TOPIC_NAME = "sb_mgmt_demo_topic" +TOPIC_NAME = "sb_mgmt_demo_topic_async" async def create_topic(servicebus_mgmt_client): From 4d3cf7590a7144964082a7003da731eafe19b2ae Mon Sep 17 00:00:00 2001 From: Swathi Pillalamarri Date: Wed, 3 Feb 2021 14:20:01 -0500 Subject: [PATCH 5/6] randomized names of resources created w mgmt to avoid conflict --- .../samples/async_samples/mgmt_queue_async.py | 3 ++- .../azure-servicebus/samples/async_samples/mgmt_rule_async.py | 3 ++- .../samples/async_samples/mgmt_subscription_async.py | 3 ++- .../samples/async_samples/mgmt_topic_async.py | 3 ++- .../azure-servicebus/samples/sync_samples/mgmt_queue.py | 3 ++- .../azure-servicebus/samples/sync_samples/mgmt_rule.py | 4 +++- .../samples/sync_samples/mgmt_subscription.py | 4 +++- .../azure-servicebus/samples/sync_samples/mgmt_topic.py | 4 +++- 8 files changed, 19 insertions(+), 8 deletions(-) diff --git a/sdk/servicebus/azure-servicebus/samples/async_samples/mgmt_queue_async.py b/sdk/servicebus/azure-servicebus/samples/async_samples/mgmt_queue_async.py index f3585057336e..bac54851e511 100644 --- a/sdk/servicebus/azure-servicebus/samples/async_samples/mgmt_queue_async.py +++ b/sdk/servicebus/azure-servicebus/samples/async_samples/mgmt_queue_async.py @@ -18,10 +18,11 @@ import os import asyncio +import uuid from azure.servicebus.aio.management import ServiceBusAdministrationClient CONNECTION_STR = os.environ['SERVICE_BUS_CONNECTION_STR'] -QUEUE_NAME = "sb_mgmt_demo_queue_async" +QUEUE_NAME = "sb_mgmt_queue" + str(uuid.uuid4()) async def create_queue(servicebus_mgmt_client): diff --git a/sdk/servicebus/azure-servicebus/samples/async_samples/mgmt_rule_async.py b/sdk/servicebus/azure-servicebus/samples/async_samples/mgmt_rule_async.py index f30403fc6e3a..efba5046a58c 100644 --- a/sdk/servicebus/azure-servicebus/samples/async_samples/mgmt_rule_async.py +++ b/sdk/servicebus/azure-servicebus/samples/async_samples/mgmt_rule_async.py @@ -18,12 +18,13 @@ import os import asyncio +import uuid from azure.servicebus.aio.management import ServiceBusAdministrationClient CONNECTION_STR = os.environ['SERVICE_BUS_CONNECTION_STR'] TOPIC_NAME = os.environ['SERVICE_BUS_TOPIC_NAME'] SUBSCRIPTION_NAME = os.environ['SERVICE_BUS_SUBSCRIPTION_NAME'] -RULE_NAME = "sb_mgmt_demo_rule_async" +RULE_NAME = "sb_mgmt_rule" + str(uuid.uuid4()) async def create_rule(servicebus_mgmt_client): diff --git a/sdk/servicebus/azure-servicebus/samples/async_samples/mgmt_subscription_async.py b/sdk/servicebus/azure-servicebus/samples/async_samples/mgmt_subscription_async.py index e3e0834bca8c..d2ceec52cb25 100644 --- a/sdk/servicebus/azure-servicebus/samples/async_samples/mgmt_subscription_async.py +++ b/sdk/servicebus/azure-servicebus/samples/async_samples/mgmt_subscription_async.py @@ -18,11 +18,12 @@ import os import asyncio +import uuid from azure.servicebus.aio.management import ServiceBusAdministrationClient CONNECTION_STR = os.environ['SERVICE_BUS_CONNECTION_STR'] TOPIC_NAME = os.environ['SERVICE_BUS_TOPIC_NAME'] -SUBSCRIPTION_NAME = "sb_mgmt_demo_subscription_async" +SUBSCRIPTION_NAME = "sb_mgmt_sub" + str(uuid.uuid4()) async def create_subscription(servicebus_mgmt_client): diff --git a/sdk/servicebus/azure-servicebus/samples/async_samples/mgmt_topic_async.py b/sdk/servicebus/azure-servicebus/samples/async_samples/mgmt_topic_async.py index 0a02449f616e..29bec799c8fc 100644 --- a/sdk/servicebus/azure-servicebus/samples/async_samples/mgmt_topic_async.py +++ b/sdk/servicebus/azure-servicebus/samples/async_samples/mgmt_topic_async.py @@ -18,10 +18,11 @@ import os import asyncio +import uuid from azure.servicebus.aio.management import ServiceBusAdministrationClient CONNECTION_STR = os.environ['SERVICE_BUS_CONNECTION_STR'] -TOPIC_NAME = "sb_mgmt_demo_topic_async" +TOPIC_NAME = "sb_mgmt_topic" + str(uuid.uuid4()) async def create_topic(servicebus_mgmt_client): diff --git a/sdk/servicebus/azure-servicebus/samples/sync_samples/mgmt_queue.py b/sdk/servicebus/azure-servicebus/samples/sync_samples/mgmt_queue.py index 733a301ecdfc..db4cbe15222c 100644 --- a/sdk/servicebus/azure-servicebus/samples/sync_samples/mgmt_queue.py +++ b/sdk/servicebus/azure-servicebus/samples/sync_samples/mgmt_queue.py @@ -17,10 +17,11 @@ # pylint: disable=C0111 import os +import uuid from azure.servicebus.management import ServiceBusAdministrationClient CONNECTION_STR = os.environ['SERVICE_BUS_CONNECTION_STR'] -QUEUE_NAME = "sb_mgmt_demo_queue" +QUEUE_NAME = "sb_mgmt_queue" + str(uuid.uuid4()) def create_queue(servicebus_mgmt_client): diff --git a/sdk/servicebus/azure-servicebus/samples/sync_samples/mgmt_rule.py b/sdk/servicebus/azure-servicebus/samples/sync_samples/mgmt_rule.py index eeb7ac6a4032..97cf0f489dad 100644 --- a/sdk/servicebus/azure-servicebus/samples/sync_samples/mgmt_rule.py +++ b/sdk/servicebus/azure-servicebus/samples/sync_samples/mgmt_rule.py @@ -17,12 +17,14 @@ # pylint: disable=C0111 import os +import uuid from azure.servicebus.management import ServiceBusAdministrationClient CONNECTION_STR = os.environ['SERVICE_BUS_CONNECTION_STR'] TOPIC_NAME = os.environ['SERVICE_BUS_TOPIC_NAME'] SUBSCRIPTION_NAME = os.environ['SERVICE_BUS_SUBSCRIPTION_NAME'] -RULE_NAME = "sb_mgmt_demo_rule" +RULE_NAME = "sb_mgmt_rule" + str(uuid.uuid4()) + def create_rule(servicebus_mgmt_client): diff --git a/sdk/servicebus/azure-servicebus/samples/sync_samples/mgmt_subscription.py b/sdk/servicebus/azure-servicebus/samples/sync_samples/mgmt_subscription.py index afec2b34bb27..89a3b5a3207b 100644 --- a/sdk/servicebus/azure-servicebus/samples/sync_samples/mgmt_subscription.py +++ b/sdk/servicebus/azure-servicebus/samples/sync_samples/mgmt_subscription.py @@ -17,11 +17,13 @@ # pylint: disable=C0111 import os +import uuid from azure.servicebus.management import ServiceBusAdministrationClient CONNECTION_STR = os.environ['SERVICE_BUS_CONNECTION_STR'] TOPIC_NAME = os.environ['SERVICE_BUS_TOPIC_NAME'] -SUBSCRIPTION_NAME = "sb_mgmt_demo_subscription" +SUBSCRIPTION_NAME = "sb_mgmt_sub" + str(uuid.uuid4()) + def create_subscription(servicebus_mgmt_client): diff --git a/sdk/servicebus/azure-servicebus/samples/sync_samples/mgmt_topic.py b/sdk/servicebus/azure-servicebus/samples/sync_samples/mgmt_topic.py index f1375c79bc1e..792b1088bfe3 100644 --- a/sdk/servicebus/azure-servicebus/samples/sync_samples/mgmt_topic.py +++ b/sdk/servicebus/azure-servicebus/samples/sync_samples/mgmt_topic.py @@ -17,10 +17,12 @@ # pylint: disable=C0111 import os +import uuid from azure.servicebus.management import ServiceBusAdministrationClient CONNECTION_STR = os.environ['SERVICE_BUS_CONNECTION_STR'] -TOPIC_NAME = "sb_mgmt_demo_topic" +TOPIC_NAME = "sb_mgmt_topic" + str(uuid.uuid4()) + def create_topic(servicebus_mgmt_client): From 1a8275016d987875bff6a906b2db04da4bfce09b Mon Sep 17 00:00:00 2001 From: Swathi Pillalamarri Date: Tue, 9 Feb 2021 15:53:53 -0500 Subject: [PATCH 6/6] ignore samples with errors, fix in diff PR --- scripts/devops_tasks/test_run_samples.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/devops_tasks/test_run_samples.py b/scripts/devops_tasks/test_run_samples.py index 947872c3b944..cbdb81eb195f 100644 --- a/scripts/devops_tasks/test_run_samples.py +++ b/scripts/devops_tasks/test_run_samples.py @@ -28,10 +28,20 @@ "consume_cloud_events_from_storage_queue.py"], "azure-servicebus": [ "failure_and_recovery.py", + "mgmt_queue.py", + "mgmt_rule.py", + "mgmt_subscription.py", + "mgmt_topic.py", "proxy.py", + "receive_deferred_message_queue.py", "receive_iterator_queue.py", "session_pool_receive.py", + "mgmt_queue_async.py", + "mgmt_rule_async.py", + "mgmt_subscription_async.py", + "mgmt_topic_async.py", "proxy_async.py", + "receive_deferred_message_queue_async.py", "receive_iterator_queue_async.py", "session_pool_receive_async.py" ]