From 21215703aa4abf20202afa88c59cb8ee6c203b01 Mon Sep 17 00:00:00 2001
From: Madalyn Redding Heaps <66138537+m-redding@users.noreply.github.com>
Date: Fri, 13 Sep 2024 17:30:44 -0400
Subject: [PATCH] Fix Service Bus test environment (#45969)
* Fix Service Bus test env
* Update ci.functions.yml
* Update ci.functions.yml
---
.../ServiceBusTestEnvironment.cs | 22 +++++++++++++++++++
sdk/servicebus/ci.functions.yml | 2 ++
sdk/servicebus/test-resources.json | 8 +++++++
3 files changed, 32 insertions(+)
diff --git a/sdk/servicebus/Azure.Messaging.ServiceBus/tests/Infrastructure/ServiceBusTestEnvironment.cs b/sdk/servicebus/Azure.Messaging.ServiceBus/tests/Infrastructure/ServiceBusTestEnvironment.cs
index dcac4076d0af7..3affbfd4e9872 100644
--- a/sdk/servicebus/Azure.Messaging.ServiceBus/tests/Infrastructure/ServiceBusTestEnvironment.cs
+++ b/sdk/servicebus/Azure.Messaging.ServiceBus/tests/Infrastructure/ServiceBusTestEnvironment.cs
@@ -24,6 +24,28 @@ public class ServiceBusTestEnvironment : TestEnvironment
/// The active Service Bus namespace for this test run.
private ServiceBusConnectionStringProperties ParsedConnectionString => ServiceBusConnectionStringProperties.Parse(ServiceBusConnectionString);
+ ///
+ /// The connection string for the premium Service Bus namespace instance to be used for
+ /// Live tests.
+ ///
+ ///
+ /// The connection string will be determined by creating an ephemeral Service Bus namespace for the test execution.
+ ///
+ public string ServiceBusPremiumNamespaceConnectionString => GetRecordedVariable(
+ "SERVICEBUS_PREMIUM_NAMESPACE_CONNECTION_STRING",
+ options => options.HasSecretConnectionStringParameter("SharedAccessKey", SanitizedValue.Base64));
+
+ ///
+ /// The connection string for the secondary Service Bus namespace instance to be used for
+ /// Live tests.
+ ///
+ ///
+ /// The connection string will be determined by creating an ephemeral Service Bus namespace for the test execution.
+ ///
+ public string ServiceBusSecondaryNamespaceConnectionString => GetRecordedVariable(
+ "SERVICEBUS_SECONDARY_NAMESPACE_CONNECTION_STRING",
+ options => options.HasSecretConnectionStringParameter("SharedAccessKey", SanitizedValue.Base64));
+
///
/// The connection string for the Service Bus namespace instance to be used for
/// Live tests.
diff --git a/sdk/servicebus/ci.functions.yml b/sdk/servicebus/ci.functions.yml
index 98d2d6249abb6..4f9f7debfd17e 100644
--- a/sdk/servicebus/ci.functions.yml
+++ b/sdk/servicebus/ci.functions.yml
@@ -11,6 +11,8 @@ trigger:
- sdk/servicebus/service.projects
- sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus
- sdk/servicebus/ci.functions.yml
+ - sdk/servicebus/Azure.Messaging.ServiceBus/tests/Infrastructure
+ - sdk/servicebus/test-resources.json
pr:
branches:
diff --git a/sdk/servicebus/test-resources.json b/sdk/servicebus/test-resources.json
index 6a613f4e8fdbf..abe2e9596008b 100755
--- a/sdk/servicebus/test-resources.json
+++ b/sdk/servicebus/test-resources.json
@@ -183,10 +183,18 @@
"type": "string",
"value": "[listkeys(variables('authRuleResourceId'), variables('sbVersion')).primaryConnectionString]"
},
+ "SERVICEBUS_SECONDARY_NAMESPACE_CONNECTION_STRING": {
+ "type": "string",
+ "value": "[listkeys(variables('authRuleSecondaryResourceId'), variables('sbVersion')).primaryConnectionString]"
+ },
"SERVICEBUS_SECONDARY_FULLY_QUALIFIED_NAMESPACE": {
"type": "string",
"value": "[reference(resourceId('Microsoft.ServiceBus/namespaces', variables('serviceBusSecondaryNamespace'))).serviceBusEndpoint]"
},
+ "SERVICEBUS_PREMIUM_NAMESPACE_CONNECTION_STRING": {
+ "type": "string",
+ "value": "[listkeys(variables('authRulePremiumResourceId'), variables('sbVersion')).primaryConnectionString]"
+ },
"SERVICEBUS_PREMIUM_FULLY_QUALIFIED_NAMESPACE": {
"type": "string",
"value": "[reference(resourceId('Microsoft.ServiceBus/namespaces', variables('serviceBusPremiumNamespace'))).serviceBusEndpoint]"