@@ -38,13 +38,20 @@ var _ = Describe("OperatorPolicy", func() {
3838 Pattern : "test-queue" ,
3939 ApplyTo : "queues" ,
4040 Definition : & runtime.RawExtension {
41- Raw : []byte (`{"ha-mode":"all" }` ),
41+ Raw : []byte (`{"delivery-limit": 5 }` ),
4242 },
4343 },
4444 }
4545 })
4646
4747 AfterEach (func () {
48+ if CurrentSpecReport ().Failed () {
49+ out , err := kubectl ("logs" , "-n" , "rabbitmq-system" , rmq .Name + "server-0" )
50+ if err != nil {
51+ GinkgoWriter .Printf ("error getting rabbitmq logs: %v\n " , err )
52+ }
53+ GinkgoWriter .Printf ("rabbitmq logs:\n %s\n " , string (out ))
54+ }
4855 _ = k8sClient .Delete (ctx , policy )
4956 })
5057
@@ -66,7 +73,7 @@ var _ = Describe("OperatorPolicy", func() {
6673 "Priority" : Equal (0 ),
6774 }))
6875
69- Expect (fetchedPolicy .Definition ).To (HaveKeyWithValue ("ha-mode " , "all" ))
76+ Expect (fetchedPolicy .Definition ).To (HaveKeyWithValue ("delivery-limit " , BeEquivalentTo ( 5 ) ))
7077
7178 By ("updating status condition 'Ready'" )
7279 updatedPolicy := topology.OperatorPolicy {}
@@ -97,9 +104,7 @@ var _ = Describe("OperatorPolicy", func() {
97104 By ("updating operator policy definitions successfully" )
98105 Expect (k8sClient .Get (ctx , types.NamespacedName {Name : policy .Name , Namespace : policy .Namespace }, policy )).To (Succeed ())
99106 policy .Spec .Definition = & runtime.RawExtension {
100- Raw : []byte (`{"ha-mode":"exactly",
101- "ha-params": 2
102- }` )}
107+ Raw : []byte (`{"delivery-limit": 3, "expires": 1800}` )}
103108 Expect (k8sClient .Update (ctx , policy , & client.UpdateOptions {})).To (Succeed ())
104109
105110 Eventually (func () rabbithole.PolicyDefinition {
@@ -109,8 +114,8 @@ var _ = Describe("OperatorPolicy", func() {
109114 return fetchedPolicy .Definition
110115 }, 10 , 2 ).Should (HaveLen (2 ))
111116
112- Expect (fetchedPolicy .Definition ).To (HaveKeyWithValue ("ha-mode " , "exactly" ))
113- Expect (fetchedPolicy .Definition ).To (HaveKeyWithValue ("ha-params " , float64 ( 2 )))
117+ Expect (fetchedPolicy .Definition ).To (HaveKeyWithValue ("delivery-limit " , BeEquivalentTo ( 3 ) ))
118+ Expect (fetchedPolicy .Definition ).To (HaveKeyWithValue ("expires " , BeEquivalentTo ( 1800 )))
114119
115120 By ("deleting policy" )
116121 Expect (k8sClient .Delete (ctx , policy )).To (Succeed ())
0 commit comments