Skip to content

Commit

Permalink
Get connection string for Management API tests from environment varia…
Browse files Browse the repository at this point in the history
…ble if possible
  • Loading branch information
abparticular committed Nov 25, 2024
1 parent 1b0626e commit 3bfa073
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace NServiceBus.Transport.RabbitMQ.Tests.Connection.ManagementConnection
{
using System;
using System.Collections.Generic;
using System.Net;
using System.Threading.Tasks;
Expand All @@ -14,17 +15,18 @@ namespace NServiceBus.Transport.RabbitMQ.Tests.Connection.ManagementConnection


[TestFixture]
class When_connecting_to_the_rabbitmq_management_api : RabbitMQTransport
class When_connecting_to_the_rabbitmq_management_api
{
ConnectionConfiguration connectionConfiguration = ConnectionConfiguration.Create("host=localhost");
static readonly string connectionString = Environment.GetEnvironmentVariable("RabbitMQTransport_ConnectionString") ?? "host=localhost";
readonly ConnectionConfiguration connectionConfiguration = ConnectionConfiguration.Create(connectionString);
protected QueueType queueType = QueueType.Quorum;
protected string ReceiverQueue => GetTestQueueName("ManagementAPITestQueue");
protected string GetTestQueueName(string queueName) => $"{queueName}-{queueType}";

[SetUp]
public async Task SetUp()
{
var connectionFactory = new ConnectionFactory(ReceiverQueue, connectionConfiguration, null, !ValidateRemoteCertificate, UseExternalAuthMechanism, HeartbeatInterval, NetworkRecoveryInterval, []);
var connectionFactory = new ConnectionFactory(ReceiverQueue, connectionConfiguration, null, false, false, TimeSpan.FromSeconds(60), TimeSpan.FromSeconds(10), []);
IConnection connection = await connectionFactory.CreateConnection(ReceiverQueue).ConfigureAwait(false);
var createChannelOptions = new CreateChannelOptions(publisherConfirmationsEnabled: false, publisherConfirmationTrackingEnabled: false);
var channel = await connection.CreateChannelAsync(createChannelOptions).ConfigureAwait(false);
Expand Down

0 comments on commit 3bfa073

Please sign in to comment.