From 1d6532912e5c235c867e8fef985c5d94c32b9322 Mon Sep 17 00:00:00 2001 From: Luke Bakken Date: Sun, 7 Jul 2024 16:29:19 -0700 Subject: [PATCH] Add test that demonstrates that RabbitMQ behaves according to spec Related to #273 --- .ci/versions.json | 4 ++-- integration_test.go | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/.ci/versions.json b/.ci/versions.json index 231e0b5..5753333 100644 --- a/.ci/versions.json +++ b/.ci/versions.json @@ -1,4 +1,4 @@ { - "erlang": "26.2.2", - "rabbitmq": "3.13.0" + "erlang": "26.2.5.1", + "rabbitmq": "3.13.4" } diff --git a/integration_test.go b/integration_test.go index 7d0d93c..001fd48 100644 --- a/integration_test.go +++ b/integration_test.go @@ -286,6 +286,49 @@ func TestIntegrationQueueDeclarePassiveOnMissingExchangeShouldError(t *testing.T } } +// https://github.com/rabbitmq/amqp091-go/issues/273 +// Note: RabbitMQ behaves according to spec. +// Passive declarations ignore everything but the queue name +// #themoreuknow +func TestIntegrationQueueDeclarePassiveOnQueueTypeMismatchShouldError(t *testing.T) { + c := integrationConnection(t, t.Name()) + if c != nil { + defer c.Close() + + ch, err := c.Channel() + if err != nil { + t.Fatalf("create channel1: %s", err) + } + defer ch.Close() + + queueName := t.Name() + + if _, err := ch.QueueDeclare( + queueName, // name + false, // durable + true, // auto-delete + false, // exclusive + false, // noWait + nil, // arguments + ); err != nil { + t.Fatalf("queue declare: %s", err) + } + + args := Table{QueueTypeArg: QueueTypeQuorum} + + if _, err := ch.QueueDeclarePassive( + queueName, // name + false, // duration (note: not durable) + true, // auto-delete + false, // exclusive + false, // noWait + args, // arguments + ); err != nil { + t.Fatal("QueueDeclarePassive with mismatched queue type should NOT error") + } + } +} + // https://github.com/streadway/amqp/issues/94 func TestIntegrationPassiveQueue(t *testing.T) { c := integrationConnection(t, "queue")