@@ -3266,14 +3266,48 @@ var _ = Describe("RabbitMQ HTTP API client", func() {
32663266 })
32673267 })
32683268 Context ("POST /api/definitions" , func () {
3269+ queueName , exchangeName := "definitions_test_queue" , "definitions_test_exchange"
3270+ bi := BindingInfo {
3271+ Source : exchangeName ,
3272+ Vhost : "/" ,
3273+ DestinationType : "queue" ,
3274+ Destination : queueName ,
3275+ Arguments : map [string ]interface {}{},
3276+ }
32693277 It ("should create queues and exchanges as specified in the definitions" , func () {
3270- defs := & ExportedDefinitions {
3271- Queues : & []QueueInfo {{Name : "definitions_test_queue" , Vhost : "/" , Durable : true }},
3272- Exchanges : & []ExchangeInfo {{Name : "definitions_test_exchange" , Vhost : "/" , Durable : true }},
3273- Bindings : & []BindingInfo {{Source : "definitions_test_exchange" , Vhost : "/" , DestinationType : "queue" , Destination : "definitions_test_exchange" }},
3278+ defsToUpload := & ExportedDefinitions {
3279+ Policies : & []PolicyDefinition {},
3280+ Queues : & []QueueInfo {{
3281+ Name : queueName ,
3282+ Vhost : "/" ,
3283+ Durable : true ,
3284+ Arguments : map [string ]interface {}{},
3285+ }},
3286+ Exchanges : & []ExchangeInfo {{
3287+ Name : exchangeName ,
3288+ Vhost : "/" ,
3289+ Durable : true ,
3290+ Type : "direct" ,
3291+ Arguments : map [string ]interface {}{},
3292+ }},
3293+ Bindings : & []BindingInfo {bi },
32743294 }
3275- _ , err := rmqc .UploadDefinitions (defs )
3295+ _ , err := rmqc .UploadDefinitions (defsToUpload )
3296+ Expect (err ).Should (BeNil ())
3297+
3298+ defs , err := rmqc .ListDefinitions ()
32763299 Expect (err ).Should (BeNil ())
3300+
3301+ queueDefs := defs .Queues
3302+ exchangeDefs := defs .Exchanges
3303+ bindingDefs := defs .Bindings
3304+ Expect (queueDefs ).Should (BeEquivalentTo (defsToUpload .Queues ))
3305+ Expect (exchangeDefs ).Should (BeEquivalentTo (defsToUpload .Exchanges ))
3306+ Expect (bindingDefs ).Should (BeEquivalentTo (defs .Bindings ))
3307+
3308+ _ , _ = rmqc .DeleteExchange ("/" , exchangeName )
3309+ _ , _ = rmqc .DeleteQueue ("/" , queueName )
3310+ _ , _ = rmqc .DeleteBinding ("/" , bi )
32773311 })
32783312 })
32793313})
0 commit comments