Skip to content

Commit

Permalink
fix e2e test
Browse files Browse the repository at this point in the history
Signed-off-by: hanenMizouni <[email protected]>
  • Loading branch information
outscale-hmi committed Nov 18, 2024
1 parent e477877 commit 6f1968c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
8 changes: 4 additions & 4 deletions cloud/scope/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,15 +270,15 @@ func (s *ClusterScope) GetIpSubnetRange(Name string) string {
return ""
}

// GetSecurityGroupRule return slices of securityGroupRule asscociated with securityGroup Name
// GetSecurityGroupRule returns slices of securityGroupRule associated with the given securityGroup Name.
// If no matching securityGroup is found, it returns a pointer to an empty slice.
func (s *ClusterScope) GetSecurityGroupRule(Name string) *[]infrastructurev1beta1.OscSecurityGroupRule {
securityGroups := s.OscCluster.Spec.Network.SecurityGroups
for _, securityGroup := range securityGroups {
for _, securityGroup := range s.OscCluster.Spec.Network.SecurityGroups {
if securityGroup.Name == Name {
return &securityGroup.SecurityGroupRules
}
}
return nil
return new([]infrastructurev1beta1.OscSecurityGroupRule) // Return pointer to an empty slice
}

// GetLinkPublicIpRef get the status of linkPublicIpRef (a Map with tag name with bastion uid associate with resource response id)
Expand Down
2 changes: 0 additions & 2 deletions controllers/osccluster_net_controller_unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ var (

// Setup set osccluster and clusterScope
func Setup(t *testing.T, name string, spec infrastructurev1beta1.OscClusterSpec) (clusterScope *scope.ClusterScope) {
t.Logf("Validate to %s", name)

oscCluster := infrastructurev1beta1.OscCluster{
Spec: spec,
ObjectMeta: metav1.ObjectMeta{
Expand Down
16 changes: 12 additions & 4 deletions testenv/osccluster_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -856,11 +856,12 @@ var _ = Describe("Outscale Cluster Reconciler", func() {
},
SecurityGroups: []*infrastructurev1beta1.OscSecurityGroup{
{
Name: "cluster-api-securitygroups",
Description: "securitygroup",
Name: "cluster-api-securitygroups",
Description: "Security group for cluster API",
DeleteDefaultOutboundRule: false, // Do not delete the default outbound rule
SecurityGroupRules: []infrastructurev1beta1.OscSecurityGroupRule{
{
Name: "cluster-api-securitygrouprule",
Name: "inbound-kube-api",
Flow: "Inbound",
IpProtocol: "tcp",
IpRange: "0.0.0.0/0",
Expand All @@ -874,6 +875,13 @@ var _ = Describe("Outscale Cluster Reconciler", func() {
IpRange: "0.0.0.0/0",
FromPortRange: 80,
ToPortRange: 80,
TargetSecurityGroupName: "cluster-api-securitygroups",
},
{
Name: "outbound-all",
Flow: "Outbound",
IpProtocol: "-1", // All protocols
IpRange: "0.0.0.0/0",
},
},
},
Expand Down Expand Up @@ -1145,4 +1153,4 @@ var _ = Describe("Outscale Cluster Reconciler", func() {
createCheckDeleteOscClusterMachine(ctx, infraClusterSpec, infraMachineSpec)
})
})
})
})

0 comments on commit 6f1968c

Please sign in to comment.