Skip to content

Commit cb25f3b

Browse files
committed
Use SatisfyAll for multiple assertions on the same object
1 parent 025afe0 commit cb25f3b

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

controllers/rabbitmqcluster_controller_test.go

+12-11
Original file line numberDiff line numberDiff line change
@@ -144,18 +144,19 @@ var _ = Describe("RabbitmqClusterController", func() {
144144
})
145145
By("recording SuccessfulCreate events for all child resources", func() {
146146
allEventMsgs := aggregateEventMsgs(ctx, cluster, "SuccessfulCreate")
147-
Expect(allEventMsgs).To(ContainSubstring("created resource %s of Type *v1.StatefulSet", cluster.ChildResourceName("server")))
148-
Expect(allEventMsgs).To(ContainSubstring("created resource %s of Type *v1.Service", cluster.ChildResourceName("")))
149-
Expect(allEventMsgs).To(ContainSubstring("created resource %s of Type *v1.Service", cluster.ChildResourceName("nodes")))
150-
Expect(allEventMsgs).To(ContainSubstring("created resource %s of Type *v1.ConfigMap", cluster.ChildResourceName("plugins-conf")))
151-
Expect(allEventMsgs).To(ContainSubstring("created resource %s of Type *v1.ConfigMap", cluster.ChildResourceName("server-conf")))
152-
Expect(allEventMsgs).To(ContainSubstring("created resource %s of Type *v1.Secret", cluster.ChildResourceName("erlang-cookie")))
153-
Expect(allEventMsgs).To(ContainSubstring("created resource %s of Type *v1.Secret", cluster.ChildResourceName("default-user")))
154-
Expect(allEventMsgs).To(ContainSubstring("created resource %s of Type *v1.ServiceAccount", cluster.ChildResourceName("server")))
155-
Expect(allEventMsgs).To(ContainSubstring("created resource %s of Type *v1.Role", cluster.ChildResourceName("peer-discovery")))
156-
Expect(allEventMsgs).To(ContainSubstring("created resource %s of Type *v1.RoleBinding", cluster.ChildResourceName("server")))
147+
Expect(allEventMsgs).To(SatisfyAll(
148+
ContainSubstring("created resource %s of Type *v1.StatefulSet", cluster.ChildResourceName("server")),
149+
ContainSubstring("created resource %s of Type *v1.Service", cluster.ChildResourceName("")),
150+
ContainSubstring("created resource %s of Type *v1.Service", cluster.ChildResourceName("nodes")),
151+
ContainSubstring("created resource %s of Type *v1.ConfigMap", cluster.ChildResourceName("plugins-conf")),
152+
ContainSubstring("created resource %s of Type *v1.ConfigMap", cluster.ChildResourceName("server-conf")),
153+
ContainSubstring("created resource %s of Type *v1.Secret", cluster.ChildResourceName("erlang-cookie")),
154+
ContainSubstring("created resource %s of Type *v1.Secret", cluster.ChildResourceName("default-user")),
155+
ContainSubstring("created resource %s of Type *v1.ServiceAccount", cluster.ChildResourceName("server")),
156+
ContainSubstring("created resource %s of Type *v1.Role", cluster.ChildResourceName("peer-discovery")),
157+
ContainSubstring("created resource %s of Type *v1.RoleBinding", cluster.ChildResourceName("server")),
158+
))
157159
})
158-
159160
})
160161
})
161162

system_tests/system_tests.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,11 @@ cluster_keepalive_interval = 10000`
176176

177177
// verify that rabbitmq.conf contains provided configurations
178178
cfgMap := getConfigFileFromPod(namespace, cluster, "/etc/rabbitmq/rabbitmq.conf")
179-
Expect(cfgMap).To(HaveKeyWithValue("vm_memory_high_watermark_paging_ratio", "0.5"))
180-
Expect(cfgMap).To(HaveKeyWithValue("cluster_keepalive_interval", "10000"))
181-
Expect(cfgMap).To(HaveKeyWithValue("cluster_partition_handling", "ignore"))
179+
Expect(cfgMap).To(SatisfyAll(
180+
HaveKeyWithValue("vm_memory_high_watermark_paging_ratio", "0.5"),
181+
HaveKeyWithValue("cluster_keepalive_interval", "10000"),
182+
HaveKeyWithValue("cluster_partition_handling", "ignore"),
183+
))
182184
})
183185

184186
By("updating the advanced.config file when advancedConfig are modified", func() {

0 commit comments

Comments
 (0)