Skip to content

Commit

Permalink
Address feedback for #217
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelklishin committed Nov 22, 2021
1 parent 9c16b7f commit 08d33bc
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 27 deletions.
12 changes: 10 additions & 2 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
## Changes Between 2.11.0 and 2.12.0 (unreleased)

Added support to manage user limits.
### Support to User Limits

Added an operation to query all vhost limits at once.
GitHub issue: [#217](https://github.com/michaelklishin/rabbit-hole/pull/217)

Contributed by @aitorpazos.

### Listing of All Virtual Host Limits

GitHub issue: [#217](https://github.com/michaelklishin/rabbit-hole/pull/217)

Contributed by @aitorpazos.

## Changes Between 2.10.0 and 2.11.0 (Sep 16, 2021)

Expand Down
40 changes: 15 additions & 25 deletions rabbithole_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1102,45 +1102,35 @@ var _ = Describe("RabbitMQ HTTP API client", func() {
})

Context("vhost-limits", func() {
maxConnections := 1
maxConnections := 10
maxQueues := 2

It("returns an empty list of limits", func() {
xs, err := rmqc.GetVhostLimits("rabbit/hole")
_, err := rmqc.DeleteVhostLimits("rabbit/hole", VhostLimits{"max-connections", "max-queues"})
Ω(err).Should(BeNil())

xs, err2 := rmqc.GetVhostLimits("rabbit/hole")
Ω(err2).Should(BeNil())
Ω(xs).Should(HaveLen(0))
})

It("sets the limits", func() {
_, err := rmqc.PutVhostLimits("rabbit/hole", VhostLimitsValues{
_, err := rmqc.DeleteVhostLimits("rabbit/hole", VhostLimits{"max-connections", "max-queues"})
Ω(err).Should(BeNil())

_, err2 := rmqc.PutVhostLimits("rabbit/hole", VhostLimitsValues{
"max-connections": maxConnections,
"max-queues": maxQueues,
})
Ω(err).Should(BeNil())
})
It("returns all the limits", func() {
xs, err := rmqc.GetAllVhostLimits()
Ω(err).Should(BeNil())
Ω(xs).Should(HaveLen(1))
Ω(xs[0].Vhost).Should(Equal("rabbit/hole"))
Ω(xs[0].Value["max-connections"]).Should(Equal(maxConnections))
Ω(xs[0].Value["max-queues"]).Should(Equal(maxQueues))
})
It("returns the limits", func() {
xs, err := rmqc.GetVhostLimits("rabbit/hole")
Ω(err).Should(BeNil())
Ω(err2).Should(BeNil())

xs, err3 := rmqc.GetAllVhostLimits()
Ω(err3).Should(BeNil())
Ω(xs).Should(HaveLen(1))
Ω(xs[0].Vhost).Should(Equal("rabbit/hole"))
Ω(xs[0].Value["max-connections"]).Should(Equal(maxConnections))
Ω(xs[0].Value["max-queues"]).Should(Equal(maxQueues))
})
It("deletes the limits", func() {
_, err := rmqc.DeleteVhostLimits("rabbit/hole", VhostLimits{"max-connections", "max-queues"})
Ω(err).Should(BeNil())
})
It("returns an empty list of limits", func() {
xs, err := rmqc.GetVhostLimits("rabbit/hole")
Ω(err).Should(BeNil())
Ω(xs).Should(HaveLen(0))
})
})

Context("user-limits", func() {
Expand Down

0 comments on commit 08d33bc

Please sign in to comment.