Skip to content

Commit 51bf249

Browse files
committed
adapt upstream mocktest branch changes
1 parent fbf17de commit 51bf249

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

controller/linodecluster_controller_test.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ var _ = Describe("cluster-lifecycle", Ordered, Label("cluster", "cluster-lifecyc
6464
},
6565
}
6666

67-
ctlrSuite := NewControllerTestSuite(mock.MockLinodeNodeBalancerClient{})
67+
ctlrSuite := NewControllerTestSuite(GinkgoT(), mock.MockLinodeNodeBalancerClient{})
6868
reconciler := LinodeClusterReconciler{
6969
Recorder: ctlrSuite.Recorder(),
7070
}
@@ -108,7 +108,7 @@ var _ = Describe("cluster-lifecycle", Ordered, Label("cluster", "cluster-lifecyc
108108
NodeBalancerID: nodebalancerID,
109109
}, nil)
110110
}),
111-
Case(
111+
Path(
112112
Call("cluster is not created because there is no nb", func(ctx context.Context, m Mock) {
113113
cScope.LinodeClient = m.NodeBalancerClient
114114
getNB := m.NodeBalancerClient.EXPECT().ListNodeBalancers(gomock.Any(), gomock.Any()).Return(nil, nil)
@@ -121,7 +121,7 @@ var _ = Describe("cluster-lifecycle", Ordered, Label("cluster", "cluster-lifecyc
121121
Expect(err.Error()).To(ContainSubstring("create NB error"))
122122
}),
123123
),
124-
Case(
124+
Path(
125125
Call("cluster is not created because there is no capl cluster", func(ctx context.Context, m Mock) {
126126
cScope.LinodeClient = m.NodeBalancerClient
127127
}),
@@ -184,6 +184,7 @@ var _ = Describe("cluster-delete", Ordered, Label("cluster", "cluster-delete"),
184184
}
185185

186186
ctlrSuite := NewControllerTestSuite(
187+
GinkgoT(),
187188
mock.MockLinodeNodeBalancerClient{},
188189
mock.MockK8sClient{},
189190
)
@@ -202,21 +203,20 @@ var _ = Describe("cluster-delete", Ordered, Label("cluster", "cluster-delete"),
202203
cScope.Client = m.K8sClient
203204
m.NodeBalancerClient.EXPECT().DeleteNodeBalancer(gomock.Any(), gomock.Any()).Return(nil)
204205
}),
205-
Case(
206+
Path(
206207
Call("nothing to do because NB ID is nil", func(ctx context.Context, m Mock) {
207208
cScope.Client = m.K8sClient
208209
cScope.LinodeClient = m.NodeBalancerClient
209210
cScope.LinodeCluster.Spec.Network.NodeBalancerID = nil
210-
// m.NodeBalancerClient.EXPECT().DeleteNodeBalancer(gomock.Any(), gomock.Any()).Return(nil)
211211
}),
212212
Result("nothing to do because NB ID is nil", func(ctx context.Context, m Mock) {
213213
reconciler.Client = m.K8sClient
214214
err := reconciler.reconcileDelete(ctx, logr.Logger{}, cScope)
215215
Expect(err).NotTo(HaveOccurred())
216-
Expect(<-m.Events()).To(ContainSubstring("Warning NodeBalancerIDMissing NodeBalancer ID is missing, nothing to do"))
216+
Expect(ctlrSuite.Events()).To(ContainSubstring("Warning NodeBalancerIDMissing NodeBalancer ID is missing, nothing to do"))
217217
}),
218218
),
219-
Case(
219+
Path(
220220
Call("cluster not deleted because the nb can't be deleted", func(ctx context.Context, m Mock) {
221221
cScope.LinodeClient = m.NodeBalancerClient
222222
cScope.Client = m.K8sClient

0 commit comments

Comments
 (0)