From 5fc010a7e1de18e40aa823ce112e80e8db49a31c Mon Sep 17 00:00:00 2001 From: Mark van Renswoude Date: Thu, 30 Mar 2023 15:45:13 +0200 Subject: [PATCH] Temporary RabbitMQ.Client version fix for #41 Added test for incompatible queue arguments --- Tapeti.Tests/Client/RabbitMQFixture.cs | 2 +- Tapeti.Tests/Client/TapetiClientTests.cs | 45 +++++++++++++++++++++++- Tapeti/Tapeti.csproj | 2 +- 3 files changed, 46 insertions(+), 3 deletions(-) diff --git a/Tapeti.Tests/Client/RabbitMQFixture.cs b/Tapeti.Tests/Client/RabbitMQFixture.cs index 4d1c66d..4a46634 100644 --- a/Tapeti.Tests/Client/RabbitMQFixture.cs +++ b/Tapeti.Tests/Client/RabbitMQFixture.cs @@ -33,7 +33,7 @@ namespace Tapeti.Tests.Client private const string ImageName = "rabbitmq"; - private const string ImageTag = "3.11.3-alpine"; + private const string ImageTag = "3.11.3-management-alpine"; public async Task InitializeAsync() diff --git a/Tapeti.Tests/Client/TapetiClientTests.cs b/Tapeti.Tests/Client/TapetiClientTests.cs index bfd1cfe..0ffd716 100644 --- a/Tapeti.Tests/Client/TapetiClientTests.cs +++ b/Tapeti.Tests/Client/TapetiClientTests.cs @@ -1,7 +1,10 @@ -using System.Text; +using System; +using System.Collections.Generic; +using System.Text; using System.Threading; using System.Threading.Tasks; using FluentAssertions; +using RabbitMQ.Client; using Tapeti.Connection; using Tapeti.Default; using Tapeti.Exceptions; @@ -68,6 +71,31 @@ namespace Tapeti.Tests.Client } + [Fact] + public async Task DurableQueueDeclareIncompatibleArguments() + { + using var rabbitmqClient = CreateRabbitMQClient(); + using var model = rabbitmqClient.CreateModel(); + + var ok = model.QueueDeclare("incompatibleargs", true, false, false, new Dictionary + { + { "x-dead-letter-exchange", "d34db33f" } + }); + + model.Close(); + rabbitmqClient.Close(); + + + ok.Should().NotBeNull(); + + + await client.DurableQueueDeclare("incompatibleargs", new QueueBinding[] + { + new("test", "#") + }, null, CancellationToken.None); + } + + [Fact] public async Task PublishHandleOverflow() { @@ -97,6 +125,21 @@ namespace Tapeti.Tests.Client // TODO test the other methods + private RabbitMQ.Client.IConnection CreateRabbitMQClient() + { + var connectionFactory = new ConnectionFactory + { + HostName = "127.0.0.1", + Port = fixture.RabbitMQPort, + UserName = RabbitMQFixture.RabbitMQUsername, + Password = RabbitMQFixture.RabbitMQPassword, + AutomaticRecoveryEnabled = false, + TopologyRecoveryEnabled = false + }; + + return connectionFactory.CreateConnection(); + } + private TapetiClient CreateClient() { diff --git a/Tapeti/Tapeti.csproj b/Tapeti/Tapeti.csproj index 2d1bd84..18a03ff 100644 --- a/Tapeti/Tapeti.csproj +++ b/Tapeti/Tapeti.csproj @@ -25,7 +25,7 @@ - +