@@ -40,7 +40,6 @@ func ProjectSpec(ctx context.Context, inputGetter func() CommonSpecInput) {
4040 namespace * corev1.Namespace
4141 cancelWatches context.CancelFunc
4242 clusterResources * clusterctl.ApplyClusterTemplateAndWaitResult
43- affinityIds []string
4443 vpcName string
4544 )
4645
@@ -69,8 +68,6 @@ func ProjectSpec(ctx context.Context, inputGetter func() CommonSpecInput) {
6968 Skip ("Failed to fetch project" )
7069 }
7170
72- // Initialize affinityIds to an empty slice to avoid nil checks
73- affinityIds = make ([]string , 0 )
7471 })
7572
7673 It ("Should create a cluster in a project" , func () {
@@ -97,15 +94,9 @@ func ProjectSpec(ctx context.Context, inputGetter func() CommonSpecInput) {
9794 // Ensure the cluster was created successfully before proceeding with checks
9895 Expect (clusterResources .Cluster ).ToNot (BeNil (), "Cluster was not created successfully" )
9996
100- By ("Checking affinity groups and VPC in project" )
97+ By ("Checking VPC in project" )
10198 csClient := CreateCloudStackClient (ctx , input .BootstrapClusterProxy .GetKubeconfigPath ())
10299
103- // Check affinity groups
104- By (fmt .Sprintf ("Checking affinity groups for cluster %s in project %s" , clusterResources .Cluster .Name , projectName ))
105- tempAffinityIds := CheckAffinityGroupInProject (csClient , clusterResources .Cluster .Name , "anti" , projectName )
106- Expect (tempAffinityIds ).ToNot (BeEmpty (), "No affinity groups found for cluster" )
107- affinityIds = tempAffinityIds
108-
109100 // Check VPC
110101 By (fmt .Sprintf ("Checking if VPC %s exists in project %s" , vpcName , projectName ))
111102 exists , err := CheckVPCExistsInProject (csClient , vpcName , projectName )
@@ -117,18 +108,6 @@ func ProjectSpec(ctx context.Context, inputGetter func() CommonSpecInput) {
117108 // Dumps all the resources in the spec namespace, then cleanups the cluster object and the spec namespace itself.
118109 dumpSpecResourcesAndCleanup (ctx , specName , input .BootstrapClusterProxy , input .ArtifactFolder , namespace , cancelWatches , clusterResources .Cluster , input .E2EConfig .GetIntervals , input .SkipCleanup )
119110
120- csClient := CreateCloudStackClient (ctx , input .BootstrapClusterProxy .GetKubeconfigPath ())
121-
122- // Only check for affinity group deletion if affinity groups were created
123- if len (affinityIds ) > 0 {
124- err := CheckAffinityGroupsDeletedInProject (csClient , affinityIds , projectName )
125- if err != nil {
126- Fail (err .Error ())
127- }
128- } else {
129- By ("Skipping affinity group deletion check as no affinity groups were created" )
130- }
131-
132111 By ("PASSED!" )
133112 })
134113}
0 commit comments