Skip to content

Commit 97b0f1e

Browse files
authored
ServiceBus (#2984)
Remove the ClientOptions from ServiceBusClientOptions. - This is not used currently Fix the default version for the ServiceBus API Remove code that supported connection_strings in tests. - Connection strings are not used in tests
1 parent 20c4d75 commit 97b0f1e

File tree

7 files changed

+5
-71
lines changed

7 files changed

+5
-71
lines changed

sdk/servicebus/azure_messaging_servicebus/CONTRIBUTING.md

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,6 @@ This will automatically create:
3434
- RBAC permissions for TokenCredential testing
3535
- All required environment variables
3636

37-
The script will output PowerShell commands to set environment variables.
38-
39-
### Environment Variables
40-
41-
After deployment completes successfully, the script will output commands like:
42-
43-
```powershell
44-
$env:SERVICEBUS_NAMESPACE = "sb-your-deployment-name.servicebus.windows.net"
45-
$env:SERVICEBUS_QUEUE_NAME = "testqueue"
46-
$env:SERVICEBUS_TOPIC_NAME = "testtopic"
47-
$env:SERVICEBUS_SUBSCRIPTION_NAME = "testsubscription"
48-
```
49-
5037
## Run Live Tests
5138

5239
Once the environment variables are set, run the tests:

sdk/servicebus/azure_messaging_servicebus/src/client.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::{
55
common::authorizer::Authorizer, ErrorKind, ReceiveMode, Receiver, Result, Sender,
66
ServiceBusError,
77
};
8-
use azure_core::{credentials::TokenCredential, fmt::SafeDebug, http::ClientOptions, http::Url};
8+
use azure_core::{credentials::TokenCredential, fmt::SafeDebug, http::Url};
99
use azure_core_amqp::{
1010
AmqpConnection, AmqpConnectionApis, AmqpConnectionOptions, AmqpOrderedMap, AmqpSymbol,
1111
AmqpValue,
@@ -25,7 +25,7 @@ pub enum SubQueue {
2525

2626
impl SubQueue {
2727
/// Returns the path suffix for the sub-queue.
28-
pub fn as_path_suffix(&self) -> &'static str {
28+
pub(crate) fn as_path_suffix(&self) -> &'static str {
2929
match self {
3030
SubQueue::DeadLetter => "/$DeadLetterQueue",
3131
SubQueue::Transfer => "/$Transfer/$DeadLetterQueue",
@@ -39,9 +39,6 @@ pub struct ServiceBusClientOptions {
3939
/// The API version to use when communicating with the Service Bus service.
4040
pub api_version: String,
4141

42-
/// Core client configuration options.
43-
pub client_options: ClientOptions,
44-
4542
/// Application ID that will be passed to the namespace.
4643
///
4744
/// This optional identifier is passed to the Service Bus namespace during connection establishment
@@ -52,8 +49,7 @@ pub struct ServiceBusClientOptions {
5249
impl Default for ServiceBusClientOptions {
5350
fn default() -> Self {
5451
Self {
55-
api_version: "2017-04".to_string(), // Default Service Bus API version
56-
client_options: ClientOptions::default(),
52+
api_version: "2021-05".to_string(), // Default Service Bus API version
5753
application_id: None,
5854
}
5955
}

sdk/servicebus/azure_messaging_servicebus/src/receiver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2255,7 +2255,7 @@ mod tests {
22552255
Arc::new(AmqpConnection::new())
22562256
}
22572257

2258-
/// Creates a test ClientOptions
2258+
/// Creates test ServiceBusClientOptions
22592259
fn create_test_options() -> ServiceBusClientOptions {
22602260
Default::default()
22612261
}

sdk/servicebus/azure_messaging_servicebus/src/sender.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ mod tests {
575575
Arc::new(AmqpConnection::new())
576576
}
577577

578-
/// Creates a test ClientOptions
578+
/// Creates test ServiceBusClientOptions
579579
fn create_test_options() -> ServiceBusClientOptions {
580580
Default::default()
581581
}

sdk/servicebus/azure_messaging_servicebus/test-resources-post.ps1

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -50,44 +50,6 @@ $resourceGroup = $DeploymentOutputs['RESOURCE_GROUP']
5050
Write-Host "Service Bus Namespace: $namespaceName"
5151
Write-Host "Resource Group: $resourceGroup"
5252

53-
# Retrieve connection strings (these contain secrets so aren't in Bicep outputs)
54-
Write-Host "Retrieving Service Bus connection strings..."
55-
56-
try {
57-
$connectionString = az servicebus namespace authorization-rule keys list `
58-
--resource-group $resourceGroup `
59-
--namespace-name $namespaceName `
60-
--name RootManageSharedAccessKey `
61-
--query primaryConnectionString `
62-
--output tsv
63-
64-
$listenOnlyConnectionString = az servicebus namespace authorization-rule keys list `
65-
--resource-group $resourceGroup `
66-
--namespace-name $namespaceName `
67-
--name ListenOnly `
68-
--query primaryConnectionString `
69-
--output tsv
70-
71-
$sendOnlyConnectionString = az servicebus namespace authorization-rule keys list `
72-
--resource-group $resourceGroup `
73-
--namespace-name $namespaceName `
74-
--name SendOnly `
75-
--query primaryConnectionString `
76-
--output tsv
77-
78-
Write-Host "✅ Connection strings retrieved successfully"
79-
80-
# Set additional outputs for the test pipeline
81-
if ($CI) {
82-
Write-Host "##vso[task.setvariable variable=SERVICEBUS_CONNECTION_STRING;issecret=true]$connectionString"
83-
Write-Host "##vso[task.setvariable variable=SERVICEBUS_LISTEN_ONLY_CONNECTION_STRING;issecret=true]$listenOnlyConnectionString"
84-
Write-Host "##vso[task.setvariable variable=SERVICEBUS_SEND_ONLY_CONNECTION_STRING;issecret=true]$sendOnlyConnectionString"
85-
}
86-
}
87-
catch {
88-
Write-Warning "Failed to retrieve connection strings: $($_.Exception.Message)"
89-
}
90-
9153
Write-Host "##[endgroup]"
9254

9355
Write-Host "Service Bus post-deployment setup completed successfully."

sdk/servicebus/azure_messaging_servicebus/test-resources.bicep

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,4 @@ output SERVICEBUS_TOPIC_NAME string = serviceBusNamespace::topic.name
192192

193193
output SERVICEBUS_SUBSCRIPTION_NAME string = serviceBusNamespace::topic::subscription.name
194194

195-
// Connection strings contain secrets and should be retrieved via Azure CLI or portal
196-
// output SERVICEBUS_CONNECTION_STRING string = serviceBusNamespace::rootSharedAccessKey.listKeys().primaryConnectionString
197-
// output SERVICEBUS_LISTEN_ONLY_CONNECTION_STRING string = serviceBusNamespace::listenOnlyKey.listKeys().primaryConnectionString
198-
// output SERVICEBUS_SEND_ONLY_CONNECTION_STRING string = serviceBusNamespace::sendOnlyKey.listKeys().primaryConnectionString
199-
200195
output RESOURCE_GROUP string = resourceGroup().name

sdk/servicebus/azure_messaging_servicebus/tests/common/mod.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@ pub fn setup() {
2121
});
2222
}
2323

24-
#[allow(dead_code)]
25-
pub fn get_connection_string() -> Result<String, Box<dyn Error>> {
26-
env::var("SERVICEBUS_CONNECTION_STRING")
27-
.map_err(|_| "SERVICEBUS_CONNECTION_STRING environment variable not set".into())
28-
}
29-
3024
#[allow(dead_code)]
3125
pub fn get_queue_name() -> Result<String, Box<dyn Error>> {
3226
env::var("SERVICEBUS_QUEUE_NAME")

0 commit comments

Comments
 (0)