Skip to content
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

Support default queue type for vhost. #261

Merged
merged 2 commits into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions rabbithole_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1195,6 +1195,35 @@ var _ = Describe("RabbitMQ HTTP API client", func() {
_, err = rmqc.DeleteVhost(vh)
Ω(err).Should(BeNil())
})
When("A default queue type is set", func() {
It("creates a vhost with a default queue type", func(){
vh := "rabbit/hole3"
tags := VhostTags{"production", "eu-west-1"}
vs := VhostSettings{Description: "rabbit/hole3 vhost", DefaultQueueType: "quorum", Tags: tags, Tracing: false}
_, err := rmqc.PutVhost(vh, vs)
Ω(err).Should(BeNil())

shortSleep()
Eventually(func(g Gomega) string {
v, err := rmqc.GetVhost(vh)
Ω(err).Should(BeNil())

return v.Name
}).Should(Equal(vh))

x, err := rmqc.GetVhost(vh)
Ω(err).Should(BeNil())

Ω(x.Name).Should(BeEquivalentTo(vh))
Ω(x.Description).Should(BeEquivalentTo("rabbit/hole3 vhost"))
Ω(x.DefaultQueueType).Should(BeEquivalentTo("quorum"))
Ω(x.Tags).Should(Equal(tags))
Ω(x.Tracing).Should(Equal(false))

_, err = rmqc.DeleteVhost(vh)
Ω(err).Should(BeNil())
})
})
})

Context("DELETE /vhosts/{name}", func() {
Expand Down
4 changes: 4 additions & 0 deletions vhosts.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ type VhostInfo struct {
Description string `json:"description"`
// Virtual host tags
Tags VhostTags `json:"tags"`
// Type of queue to create in virtual host when unspecified
DefaultQueueType string `json:"default_queue_type"`
// True if tracing is enabled for this virtual host
Tracing bool `json:"tracing"`

Expand Down Expand Up @@ -161,6 +163,8 @@ type VhostSettings struct {
Description string `json:"description"`
// Virtual host tags
Tags VhostTags `json:"tags"`
// Type of queue to create in virtual host when unspecified
DefaultQueueType string `json:"default_queue_type,omitempty"`
// True if tracing should be enabled.
Tracing bool `json:"tracing"`
}
Expand Down