Skip to content

Commit af16449

Browse files
committed
Fix lint errors
Used ginkgolinter.
1 parent 63a078d commit af16449

File tree

5 files changed

+16
-15
lines changed

5 files changed

+16
-15
lines changed

controllers/rabbitmqcluster_controller_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ var _ = Describe("RabbitmqClusterController", func() {
6565
Eventually(func() bool {
6666
err := client.Get(ctx, types.NamespacedName{Name: cluster.Name, Namespace: cluster.Namespace}, cluster)
6767
return apierrors.IsNotFound(err)
68-
}, 5).Should(BeTrue())
68+
}, 5).Should(BeTrue(), "expected to delete cluster '%s' but it still exists", cluster.Name)
6969
})
7070

7171
It("works", func() {
@@ -81,7 +81,7 @@ var _ = Describe("RabbitmqClusterController", func() {
8181

8282
Expect(sts.Name).To(Equal(cluster.ChildResourceName("server")))
8383

84-
Expect(len(sts.Spec.VolumeClaimTemplates)).To(Equal(1))
84+
Expect(sts.Spec.VolumeClaimTemplates).To(HaveLen(1))
8585
Expect(sts.Spec.VolumeClaimTemplates[0].Spec.StorageClassName).To(BeNil())
8686
})
8787

@@ -419,7 +419,7 @@ var _ = Describe("RabbitmqClusterController", func() {
419419

420420
sts := statefulSet(ctx, cluster)
421421

422-
Expect(len(sts.Spec.VolumeClaimTemplates)).To(Equal(1))
422+
Expect(sts.Spec.VolumeClaimTemplates).To(HaveLen(1))
423423
Expect(*sts.Spec.VolumeClaimTemplates[0].Spec.StorageClassName).To(Equal("my-storage-class"))
424424
actualStorageCapacity := sts.Spec.VolumeClaimTemplates[0].Spec.Resources.Requests[corev1.ResourceStorage]
425425
Expect(actualStorageCapacity).To(Equal(k8sresource.MustParse("100Gi")))
@@ -889,7 +889,7 @@ var _ = Describe("RabbitmqClusterController", func() {
889889
"app.kubernetes.io/name": "rabbitmq-sts-override" + suffix,
890890
}))
891891

892-
Expect(len(sts.Spec.VolumeClaimTemplates)).To(Equal(2))
892+
Expect(sts.Spec.VolumeClaimTemplates).To(HaveLen(2))
893893

894894
Expect(sts.Spec.VolumeClaimTemplates[0].ObjectMeta.Name).To(Equal("persistence"))
895895
Expect(sts.Spec.VolumeClaimTemplates[0].ObjectMeta.Namespace).To(Equal("default"))
@@ -1366,7 +1366,7 @@ func waitForClusterDeletion(ctx context.Context, rabbitmqCluster *rabbitmqv1beta
13661366
&rabbitmqClusterCreated,
13671367
)
13681368
return apierrors.IsNotFound(err)
1369-
}, ClusterDeletionTimeout, 1*time.Second).Should(BeTrue())
1369+
}, ClusterDeletionTimeout, 1*time.Second).Should(BeTrue(), "expected to delete cluster '%s' but it still exists", rabbitmqCluster.Name)
13701370

13711371
}
13721372

controllers/reconcile_cli_test.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package controllers_test
22

33
import (
4-
"sigs.k8s.io/controller-runtime/pkg/envtest/komega"
54
"time"
65

6+
"sigs.k8s.io/controller-runtime/pkg/envtest/komega"
7+
78
"k8s.io/apimachinery/pkg/types"
89
"k8s.io/utils/ptr"
910

@@ -238,7 +239,7 @@ var _ = Describe("Reconcile CLI", func() {
238239
Consistently(func() map[string]string {
239240
rmq := &rabbitmqv1beta1.RabbitmqCluster{}
240241
err := client.Get(ctx, types.NamespacedName{Name: cluster.Name, Namespace: cluster.Namespace}, rmq)
241-
Expect(err).To(BeNil())
242+
Expect(err).ToNot(HaveOccurred())
242243
return rmq.ObjectMeta.Annotations
243244
}, 5).ShouldNot(HaveKey("rabbitmq.com/queueRebalanceNeededAt"))
244245
})
@@ -253,7 +254,7 @@ var _ = Describe("Reconcile CLI", func() {
253254
Consistently(func() map[string]string {
254255
rmq := &rabbitmqv1beta1.RabbitmqCluster{}
255256
err := client.Get(ctx, types.NamespacedName{Name: cluster.Name, Namespace: cluster.Namespace}, rmq)
256-
Expect(err).To(BeNil())
257+
Expect(err).ToNot(HaveOccurred())
257258
return rmq.ObjectMeta.Annotations
258259
}, 5).ShouldNot(HaveKey("rabbitmq.com/queueRebalanceNeededAt"))
259260
Expect(fakeExecutor.ExecutedCommands()).NotTo(ContainElement(command{"sh", "-c", "rabbitmq-queues rebalance all"}))
@@ -297,7 +298,7 @@ var _ = Describe("Reconcile CLI", func() {
297298
Consistently(func() map[string]string {
298299
rmq := &rabbitmqv1beta1.RabbitmqCluster{}
299300
err := client.Get(ctx, types.NamespacedName{Name: cluster.Name, Namespace: cluster.Namespace}, rmq)
300-
Expect(err).To(BeNil())
301+
Expect(err).ToNot(HaveOccurred())
301302
return rmq.ObjectMeta.Annotations
302303
}, 5).ShouldNot(HaveKey("rabbitmq.com/queueRebalanceNeededAt"))
303304
})
@@ -312,7 +313,7 @@ var _ = Describe("Reconcile CLI", func() {
312313
Consistently(func() map[string]string {
313314
rmq := &rabbitmqv1beta1.RabbitmqCluster{}
314315
err := client.Get(ctx, types.NamespacedName{Name: cluster.Name, Namespace: cluster.Namespace}, rmq)
315-
Expect(err).To(BeNil())
316+
Expect(err).ToNot(HaveOccurred())
316317
return rmq.ObjectMeta.Annotations
317318
}, 5).ShouldNot(HaveKey("rabbitmq.com/queueRebalanceNeededAt"))
318319
Expect(fakeExecutor.ExecutedCommands()).NotTo(ContainElement(command{"sh", "-c", "rabbitmq-queues rebalance all"}))

internal/resource/erlang_cookie_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ var _ = Describe("ErlangCookie", func() {
6767

6868
It("creates an erlang cookie that is base64 encoded and 24 characters", func() {
6969
cookie, ok := secret.Data[".erlang.cookie"]
70-
Expect(ok).NotTo(BeFalse())
70+
Expect(ok).To(BeTrue())
7171
decodedCookie, err := b64.URLEncoding.DecodeString(string(cookie))
7272
Expect(err).NotTo(HaveOccurred())
7373
Expect(decodedCookie).To(HaveLen(24))

internal/resource/statefulset_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ var _ = Describe("StatefulSet", func() {
266266
stsBuilder := builder.StatefulSet()
267267
Expect(stsBuilder.Update(statefulSet)).To(Succeed())
268268

269-
Expect(len(statefulSet.OwnerReferences)).To(Equal(1))
269+
Expect(statefulSet.OwnerReferences).To(HaveLen(1))
270270
Expect(statefulSet.OwnerReferences[0].Name).To(Equal(builder.Instance.Name))
271271
})
272272

@@ -1496,8 +1496,8 @@ default_pass = {{ .Data.data.password }}
14961496
Expect(stsBuilder.Update(statefulSet)).To(Succeed())
14971497

14981498
container := extractContainer(statefulSet.Spec.Template.Spec.Containers, "rabbitmq")
1499-
Expect(len(container.Resources.Requests)).To(Equal(0))
1500-
Expect(len(container.Resources.Limits)).To(Equal(0))
1499+
Expect(container.Resources.Requests).To(BeEmpty())
1500+
Expect(container.Resources.Limits).To(BeEmpty())
15011501
})
15021502
})
15031503

system_tests/utils_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ func kubernetesNodeIp(ctx context.Context, clientSet *kubernetes.Clientset) stri
502502
nodes, err := clientSet.CoreV1().Nodes().List(ctx, metav1.ListOptions{})
503503
ExpectWithOffset(1, err).NotTo(HaveOccurred())
504504
ExpectWithOffset(1, nodes).ToNot(BeNil())
505-
ExpectWithOffset(1, len(nodes.Items)).To(BeNumerically(">", 0))
505+
ExpectWithOffset(1, nodes.Items).ToNot(BeEmpty())
506506

507507
var nodeIp string
508508
for _, address := range nodes.Items[0].Status.Addresses {

0 commit comments

Comments
 (0)