Skip to content

Commit

Permalink
[ServiceBus] Fix sb perf test (#29765)
Browse files Browse the repository at this point in the history
* fixes for perf bicep

* fix env vars and params
  • Loading branch information
kashifkhan authored Apr 6, 2023
1 parent b627bde commit 0b937cf
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def __init__(self, arguments) -> None:
arguments.uamqp_transport
)
self.topic_name=self.get_from_env('AZURE_SERVICEBUS_TOPIC_NAME')
self.subscription_name=self.get_from_env('AZURE_SERVICE_BUS_SUBSCRIPTION_NAME')
self.subscription_name=self.get_from_env('AZURE_SERVICEBUS_SUBSCRIPTION_NAME')

self.receiver=self.servicebus_client.get_subscription_receiver(topic_name=self.topic_name, subscription_name=self.subscription_name)
self.async_receiver=self.async_servicebus_client.get_subscription_receiver(topic_name=self.topic_name, subscription_name=self.subscription_name)
Expand Down Expand Up @@ -194,7 +194,7 @@ def __init__(self, arguments) -> None:
)

self.topic_name=self.get_from_env('AZURE_SERVICEBUS_TOPIC_NAME')
self.subscription_name=self.get_from_env('AZURE_SERVICE_BUS_SUBSCRIPTION_NAME')
self.subscription_name=self.get_from_env('AZURE_SERVICEBUS_SUBSCRIPTION_NAME')

self.receiver=self.servicebus_client.get_subscription_receiver(topic_name=self.topic_name, subscription_name=self.subscription_name)
self.async_receiver=self.async_servicebus_client.get_subscription_receiver(topic_name=self.topic_name, subscription_name=self.subscription_name)
Expand Down
32 changes: 13 additions & 19 deletions sdk/servicebus/perf-resources.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ param baseName string = resourceGroup().name
param location string = resourceGroup().location

var serviceBusNamespaceName = 'sb-${baseName}'
var serviceBusQueueName = 'sb-${baseName}-queue'
var serviceBusTopicName = 'sb-${baseName}-topic'
var serviceBusSubscriptionName = 'sb-${baseName}-subscription'
var serviceBusQueueName = '${serviceBusNamespaceName}-queue'
var serviceBusTopicName = '${serviceBusNamespaceName}-topic'
var serviceBusSubscriptionName = '${serviceBusNamespaceName}-subscription'
var defaultSASKeyName = 'RootManageSharedAccessKey'
var authRuleResourceId = resourceId('Microsoft.ServiceBus/namespaces/authorizationRules', serviceBusNamespaceName, defaultSASKeyName)
var sbVersion = '2017-04-01'


Expand All @@ -21,7 +20,8 @@ resource serviceBusNamespace 'Microsoft.ServiceBus/namespaces@2017-04-01' = {
}

resource serviceBusQueue 'Microsoft.ServiceBus/namespaces/queues@2017-04-01' = {
name: '${serviceBusNamespaceName}/${serviceBusQueueName}'
parent: serviceBusNamespace
name: serviceBusQueueName
properties: {
lockDuration: 'PT5M'
maxSizeInMegabytes: 4096
Expand All @@ -35,13 +35,11 @@ resource serviceBusQueue 'Microsoft.ServiceBus/namespaces/queues@2017-04-01' = {
enablePartitioning: false
enableExpress: false
}
dependsOn: [
serviceBusNamespace
]
}

resource serviceBusTopic 'Microsoft.ServiceBus/namespaces/topics@2017-04-01' = {
name: '${serviceBusNamespaceName}/${serviceBusTopicName}'
parent: serviceBusNamespace
name: serviceBusTopicName
properties: {
autoDeleteOnIdle: 'P10675199DT2H48M5.4775807S'
defaultMessageTimeToLive: 'P10675199DT2H48M5.4775807S'
Expand All @@ -54,21 +52,17 @@ resource serviceBusTopic 'Microsoft.ServiceBus/namespaces/topics@2017-04-01' = {
status: 'Active'
supportOrdering: true
}
dependsOn: [
serviceBusNamespace
]
}

resource serviceBusNamespace_serviceBusTopicName_serviceBusSubscriptionName 'Microsoft.ServiceBus/namespaces/topics/subscriptions@2017-04-01' = {
name: '${serviceBusNamespaceName}/${serviceBusTopicName}/${serviceBusSubscriptionName}'
resource serviceBusSubscription 'Microsoft.ServiceBus/namespaces/topics/subscriptions@2017-04-01' = {
parent: serviceBusTopic
name: serviceBusSubscriptionName
properties: {
}
dependsOn: [
serviceBusTopic
]
}


var authRuleResourceId = resourceId('Microsoft.ServiceBus/namespaces/authorizationRules', serviceBusNamespace.name, defaultSASKeyName)
output AZURE_SERVICEBUS_CONNECTION_STRING string = listkeys(authRuleResourceId, sbVersion).primaryConnectionString
output AZURE_SERVICEBUS_QUEUE_NAME string = serviceBusQueue.name
output AZURE_TOPIC_QUEUE_NAME string = serviceBusTopic.name
output AZURE_SERVICEBUS_TOPIC_NAME string = serviceBusTopic.name
output AZURE_SERVICEBUS_SUBSCRIPTION_NAME string = serviceBusSubscription.name
2 changes: 1 addition & 1 deletion sdk/servicebus/perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ parameters:
- name: Arguments
displayName: Arguments (regex of arguments to run)
type: string
default: '(1024)'
default: '.*'
- name: Iterations
displayName: Iterations (times to run each test)
type: number
Expand Down

0 comments on commit 0b937cf

Please sign in to comment.