File tree Expand file tree Collapse file tree 3 files changed +27
-4
lines changed
exp/topology/desiredstate
internal/controllers/topology/cluster Expand file tree Collapse file tree 3 files changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -1205,7 +1205,13 @@ func TestComputeControlPlaneVersion(t *testing.T) {
1205
1205
}
1206
1206
1207
1207
_ , err := r .computeControlPlaneVersion (ctx , tt .s )
1208
- g .Expect (fakeRuntimeClient .CallAllCount (runtimehooksv1 .AfterControlPlaneUpgrade ) == 1 ).To (Equal (tt .wantHookToBeCalled ))
1208
+
1209
+ if tt .wantHookToBeCalled {
1210
+ g .Expect (fakeRuntimeClient .CallAllCount (runtimehooksv1 .AfterControlPlaneUpgrade )).To (Equal (1 ), "Expected hook to be called once" )
1211
+ } else {
1212
+ g .Expect (fakeRuntimeClient .CallAllCount (runtimehooksv1 .AfterControlPlaneUpgrade )).To (Equal (0 ), "Did not expect hook to be called" )
1213
+ }
1214
+
1209
1215
g .Expect (hooks .IsPending (runtimehooksv1 .AfterControlPlaneUpgrade , tt .s .Current .Cluster )).To (Equal (tt .wantIntentToCall ))
1210
1216
g .Expect (err != nil ).To (Equal (tt .wantErr ))
1211
1217
if tt .wantHookToBeCalled && ! tt .wantErr {
Original file line number Diff line number Diff line change @@ -578,7 +578,12 @@ func TestClusterReconciler_reconcileDelete(t *testing.T) {
578
578
g .Expect (err ).ToNot (HaveOccurred ())
579
579
g .Expect (res ).To (BeComparableTo (tt .wantResult ))
580
580
g .Expect (hooks .IsOkToDelete (tt .cluster )).To (Equal (tt .wantOkToDelete ))
581
- g .Expect (fakeRuntimeClient .CallAllCount (runtimehooksv1 .BeforeClusterDelete ) == 1 ).To (Equal (tt .wantHookToBeCalled ))
581
+
582
+ if tt .wantHookToBeCalled {
583
+ g .Expect (fakeRuntimeClient .CallAllCount (runtimehooksv1 .BeforeClusterDelete )).To (Equal (1 ), "Expected hook to be called once" )
584
+ } else {
585
+ g .Expect (fakeRuntimeClient .CallAllCount (runtimehooksv1 .BeforeClusterDelete )).To (Equal (0 ), "Did not expect hook to be called" )
586
+ }
582
587
}
583
588
})
584
589
}
Original file line number Diff line number Diff line change @@ -471,7 +471,13 @@ func TestReconcile_callAfterControlPlaneInitialized(t *testing.T) {
471
471
}
472
472
473
473
err := r .callAfterControlPlaneInitialized (ctx , s )
474
- g .Expect (fakeRuntimeClient .CallAllCount (runtimehooksv1 .AfterControlPlaneInitialized ) == 1 ).To (Equal (tt .wantHookToBeCalled ))
474
+
475
+ if tt .wantHookToBeCalled {
476
+ g .Expect (fakeRuntimeClient .CallAllCount (runtimehooksv1 .AfterControlPlaneInitialized )).To (Equal (1 ), "Expected hook to be called once" )
477
+ } else {
478
+ g .Expect (fakeRuntimeClient .CallAllCount (runtimehooksv1 .AfterControlPlaneInitialized )).To (Equal (0 ), "Did not expect hook to be called" )
479
+ }
480
+
475
481
g .Expect (hooks .IsPending (runtimehooksv1 .AfterControlPlaneInitialized , tt .cluster )).To (Equal (tt .wantMarked ))
476
482
g .Expect (err != nil ).To (Equal (tt .wantError ))
477
483
})
@@ -1089,7 +1095,13 @@ func TestReconcile_callAfterClusterUpgrade(t *testing.T) {
1089
1095
}
1090
1096
1091
1097
err := r .callAfterClusterUpgrade (ctx , tt .s )
1092
- g .Expect (fakeRuntimeClient .CallAllCount (runtimehooksv1 .AfterClusterUpgrade ) == 1 ).To (Equal (tt .wantHookToBeCalled ))
1098
+
1099
+ if tt .wantHookToBeCalled {
1100
+ g .Expect (fakeRuntimeClient .CallAllCount (runtimehooksv1 .AfterClusterUpgrade )).To (Equal (1 ), "Expected hook to be called once" )
1101
+ } else {
1102
+ g .Expect (fakeRuntimeClient .CallAllCount (runtimehooksv1 .AfterClusterUpgrade )).To (Equal (0 ), "Did not expect hook to be called" )
1103
+ }
1104
+
1093
1105
g .Expect (hooks .IsPending (runtimehooksv1 .AfterClusterUpgrade , tt .s .Current .Cluster )).To (Equal (tt .wantMarked ))
1094
1106
g .Expect (err != nil ).To (Equal (tt .wantError ))
1095
1107
})
You can’t perform that action at this time.
0 commit comments