@@ -39,11 +39,11 @@ var _ = Describe("CloudStackAffinityGroupReconciler", func() {
3939 // Modify failure domain name the same way the cluster controller would.
4040 dummies .CSAffinityGroup .Spec .FailureDomainName = dummies .CSFailureDomain1 .Spec .Name
4141
42+ mockCloudClient .EXPECT ().GetOrCreateAffinityGroup (gomock .Any ()).AnyTimes ()
43+
4244 Ω (k8sClient .Create (ctx , dummies .CSFailureDomain1 ))
4345 Ω (k8sClient .Create (ctx , dummies .CSAffinityGroup )).Should (Succeed ())
4446
45- mockCloudClient .EXPECT ().GetOrCreateAffinityGroup (gomock .Any ()).AnyTimes ()
46-
4747 // Test that the AffinityGroup controller sets Status.Ready to true.
4848 Eventually (func () bool {
4949 nameSpaceFilter := & client.ListOptions {Namespace : dummies .ClusterNameSpace }
@@ -61,11 +61,11 @@ var _ = Describe("CloudStackAffinityGroupReconciler", func() {
6161 // Modify failure domain name the same way the cluster controller would.
6262 dummies .CSAffinityGroup .Spec .FailureDomainName = dummies .CSFailureDomain1 .Spec .Name
6363
64+ mockCloudClient .EXPECT ().GetOrCreateAffinityGroup (gomock .Any ()).AnyTimes ()
65+
6466 Ω (k8sClient .Create (ctx , dummies .CSFailureDomain1 ))
6567 Ω (k8sClient .Create (ctx , dummies .CSAffinityGroup )).Should (Succeed ())
6668
67- mockCloudClient .EXPECT ().GetOrCreateAffinityGroup (gomock .Any ()).AnyTimes ()
68-
6969 // Test that the AffinityGroup controller sets Status.Ready to true.
7070 Eventually (func () bool {
7171 nameSpaceFilter := & client.ListOptions {Namespace : dummies .ClusterNameSpace }
@@ -78,11 +78,12 @@ var _ = Describe("CloudStackAffinityGroupReconciler", func() {
7878 return false
7979 }, timeout ).WithPolling (pollInterval ).Should (BeTrue ())
8080
81- Ω (k8sClient .Delete (ctx , dummies .CSAffinityGroup ))
8281 mockCloudClient .EXPECT ().FetchAffinityGroup (gomock .Any ()).Do (func (arg1 interface {}) {
8382 arg1 .(* cloud.AffinityGroup ).ID = ""
8483 }).AnyTimes ().Return (nil )
8584
85+ Ω (k8sClient .Delete (ctx , dummies .CSAffinityGroup ))
86+
8687 // Once the affinity group id was set to "" the controller should remove the finalizer and unblock deleting affinity group resource
8788 Eventually (func () bool {
8889 retrievedAffinityGroup := & infrav1.CloudStackAffinityGroup {}
0 commit comments