Skip to content

Commit

Permalink
Use more readble gomega matcher to check errors
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Lipovetsky <dlipovetsky@d2iq.com>
  • Loading branch information
dlipovetsky committed Feb 14, 2020
1 parent 57a9876 commit 2750001
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,7 @@ func TestKubeadmControlPlaneReconciler_reconcileDelete(t *testing.T) {
g := NewWithT(t)

fakeClient, err := fakeClient()
g.Expect(err).To(BeNil())
g.Expect(err).NotTo(HaveOccurred())

cluster, kcp, _ := createClusterWithControlPlane()
controllerutil.AddFinalizer(kcp, controlplanev1.KubeadmControlPlaneFinalizer)
Expand All @@ -1237,7 +1237,7 @@ func TestKubeadmControlPlaneReconciler_reconcileDelete(t *testing.T) {

result, err := r.reconcileDelete(context.Background(), cluster, kcp, log.Log)
g.Expect(result).To(Equal(ctrl.Result{RequeueAfter: DeleteRequeueAfter}))
g.Expect(err).To(BeNil())
g.Expect(err).NotTo(HaveOccurred())
g.Expect(kcp.Finalizers).To(ContainElement(controlplanev1.KubeadmControlPlaneFinalizer))

controlPlaneMachines := clusterv1.MachineList{}
Expand All @@ -1249,7 +1249,7 @@ func TestKubeadmControlPlaneReconciler_reconcileDelete(t *testing.T) {
g := NewWithT(t)

fakeClient, err := fakeClient()
g.Expect(err).To(BeNil())
g.Expect(err).NotTo(HaveOccurred())

cluster, kcp, _ := createClusterWithControlPlane()
controllerutil.AddFinalizer(kcp, controlplanev1.KubeadmControlPlaneFinalizer)
Expand Down Expand Up @@ -1277,7 +1277,7 @@ func TestKubeadmControlPlaneReconciler_reconcileDelete(t *testing.T) {

result, err := r.reconcileDelete(context.Background(), cluster, kcp, log.Log)
g.Expect(result).To(Equal(ctrl.Result{Requeue: true}))
g.Expect(err).To(BeNil())
g.Expect(err).NotTo(HaveOccurred())
g.Expect(kcp.Finalizers).To(ContainElement(controlplanev1.KubeadmControlPlaneFinalizer))

controlPlaneMachines := clusterv1.MachineList{}
Expand All @@ -1289,7 +1289,7 @@ func TestKubeadmControlPlaneReconciler_reconcileDelete(t *testing.T) {
g := NewWithT(t)

fakeClient, err := fakeClient()
g.Expect(err).To(BeNil())
g.Expect(err).NotTo(HaveOccurred())

cluster, kcp, _ := createClusterWithControlPlane()
controllerutil.AddFinalizer(kcp, controlplanev1.KubeadmControlPlaneFinalizer)
Expand All @@ -1301,7 +1301,7 @@ func TestKubeadmControlPlaneReconciler_reconcileDelete(t *testing.T) {

result, err := r.reconcileDelete(context.Background(), cluster, kcp, log.Log)
g.Expect(result).To(Equal(ctrl.Result{}))
g.Expect(err).To(BeNil())
g.Expect(err).NotTo(HaveOccurred())
g.Expect(kcp.Finalizers).To(BeEmpty())
})

Expand Down Expand Up @@ -1336,7 +1336,7 @@ func TestKubeadmControlPlaneReconciler_scaleUpControlPlane(t *testing.T) {
g := NewWithT(t)

fakeClient, err := fakeClient()
g.Expect(err).To(BeNil())
g.Expect(err).NotTo(HaveOccurred())

cluster, kcp, genericMachineTemplate := createClusterWithControlPlane()
g.Expect(fakeClient.Create(context.Background(), genericMachineTemplate)).To(Succeed())
Expand Down

0 comments on commit 2750001

Please sign in to comment.