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) {
12051205 }
12061206
12071207 _ , 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+
12091215 g .Expect (hooks .IsPending (runtimehooksv1 .AfterControlPlaneUpgrade , tt .s .Current .Cluster )).To (Equal (tt .wantIntentToCall ))
12101216 g .Expect (err != nil ).To (Equal (tt .wantErr ))
12111217 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) {
578578 g .Expect (err ).ToNot (HaveOccurred ())
579579 g .Expect (res ).To (BeComparableTo (tt .wantResult ))
580580 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+ }
582587 }
583588 })
584589 }
Original file line number Diff line number Diff line change @@ -471,7 +471,13 @@ func TestReconcile_callAfterControlPlaneInitialized(t *testing.T) {
471471 }
472472
473473 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+
475481 g .Expect (hooks .IsPending (runtimehooksv1 .AfterControlPlaneInitialized , tt .cluster )).To (Equal (tt .wantMarked ))
476482 g .Expect (err != nil ).To (Equal (tt .wantError ))
477483 })
@@ -1089,7 +1095,13 @@ func TestReconcile_callAfterClusterUpgrade(t *testing.T) {
10891095 }
10901096
10911097 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+
10931105 g .Expect (hooks .IsPending (runtimehooksv1 .AfterClusterUpgrade , tt .s .Current .Cluster )).To (Equal (tt .wantMarked ))
10941106 g .Expect (err != nil ).To (Equal (tt .wantError ))
10951107 })
You can’t perform that action at this time.
0 commit comments