-
Notifications
You must be signed in to change notification settings - Fork 8
Add default queue implementation #85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e102278
ef35cd5
e5175d8
c8476bf
b2a031d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,9 +2,10 @@ package rabbitmqamqp | |||||||||
|
|
||||||||||
| import ( | ||||||||||
| "context" | ||||||||||
| "strconv" | ||||||||||
|
|
||||||||||
| . "github.com/onsi/ginkgo/v2" | ||||||||||
| . "github.com/onsi/gomega" | ||||||||||
| "strconv" | ||||||||||
| ) | ||||||||||
|
|
||||||||||
| var _ = Describe("AMQP Queue test ", func() { | ||||||||||
|
|
@@ -245,6 +246,29 @@ var _ = Describe("AMQP Queue test ", func() { | |||||||||
| Expect(err).To(Equal(ErrDoesNotExist)) | ||||||||||
| Expect(result).To(BeNil()) | ||||||||||
| }) | ||||||||||
|
|
||||||||||
| // default | ||||||||||
| It("AMQP Declare Queue with DefaultQueueSpecification should succeed", func() { | ||||||||||
| queueName := generateName("AMQP Declare Queue with DefaultQueueSpecification should succeed") | ||||||||||
| queueInfo, err := management.DeclareQueue(context.TODO(), &DefaultQueueSpecification{ | ||||||||||
| Name: queueName, | ||||||||||
| DeadLetterExchange: "dead-letter-exchange", | ||||||||||
| DeadLetterRoutingKey: "dead-letter-routing-key", | ||||||||||
| }) | ||||||||||
| Expect(err).To(BeNil()) | ||||||||||
| Expect(queueInfo).NotTo(BeNil()) | ||||||||||
| Expect(queueInfo.Name()).To(Equal(queueName)) | ||||||||||
| Expect(queueInfo.IsDurable()).To(BeTrue()) | ||||||||||
| Expect(queueInfo.IsAutoDelete()).To(BeFalse()) | ||||||||||
| Expect(queueInfo.IsExclusive()).To(BeFalse()) | ||||||||||
| Expect(queueInfo.arguments["x-dead-letter-exchange"]).To(Equal("dead-letter-exchange")) | ||||||||||
| Expect(queueInfo.arguments["x-dead-letter-routing-key"]).To(Equal("dead-letter-routing-key")) | ||||||||||
|
Comment on lines
+264
to
+265
|
||||||||||
| Expect(queueInfo.arguments["x-dead-letter-exchange"]).To(Equal("dead-letter-exchange")) | |
| Expect(queueInfo.arguments["x-dead-letter-routing-key"]).To(Equal("dead-letter-routing-key")) | |
| Expect(queueInfo.Arguments()["x-dead-letter-exchange"]).To(Equal("dead-letter-exchange")) | |
| Expect(queueInfo.Arguments()["x-dead-letter-routing-key"]).To(Equal("dead-letter-routing-key")) |
Copilot
AI
Feb 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assertion makes the test environment-dependent: RabbitMQ can be configured per-vhost to default queue type to quorum instead of classic when no x-queue-type is provided. To avoid flakiness, assert that no explicit x-queue-type was set (or only assert the DLX args), rather than hard-coding Classic here.
| // the default value for queue type is classic | |
| Expect(queueInfo.Type()).To(Equal(Classic)) | |
| // ensure no explicit queue type was set; actual default depends on broker configuration | |
| Expect(queueInfo.arguments).NotTo(HaveKey("x-queue-type")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the new default branch, toIQueueSpecification dereferences q.autoDelete and q.exclusive, but queueRecoveryRecord.autoDelete/exclusive are only populated for Classic queues in AmqpManagement.DeclareQueue. For DefaultQueueSpecification records these pointers will be nil, causing a panic during topology recovery. Consider either storing autoDelete/exclusive for default queues as well, or handling nil pointers here (e.g., defaulting to false).