Skip to content

Commit

Permalink
Add e2e test for cloudstack domain validation (#7290)
Browse files Browse the repository at this point in the history
* Add e2e test for cloudstack domain validation

* Update env variables name and add cloudstack creds env variable

* Fix lint
  • Loading branch information
sp1999 authored Jan 16, 2024
1 parent 9bb82e1 commit a99d4da
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,16 @@ env:
T_PRIVATE_REGISTRY_MIRROR_CA_CERT: "harbor-registry-data:authenticated_tinkerbell_caCert"
T_AWS_IAM_ROLE_ARN: "aws-iam-auth-role:ec2_role_arn"
T_CLOUDSTACK_DOMAIN: "cloudstack_ci_beta_connection:domain"
T_CLOUDSTACK_MULTILEVEL_DOMAIN: "cloudstack_ci_beta_connection:multilevel_domain"
T_CLOUDSTACK_CREDENTIALS: "cloudstack_ci_beta_connection:credentials"
T_CLOUDSTACK_CREDENTIALS_2: "cloudstack_ci_beta_connection:credentials_2"
T_CLOUDSTACK_CREDENTIALS_3: "cloudstack_ci_beta_connection:credentials_3"
T_CLOUDSTACK_CREDENTIALS_FOR_MULTILEVEL_DOMAIN: "cloudstack_ci_beta_connection:credentials_for_multilevel_domain"
T_CLOUDSTACK_ZONE: "cloudstack_ci_beta_connection:zone"
T_CLOUDSTACK_ZONE_2: "cloudstack_ci_beta_connection:zone_2"
T_CLOUDSTACK_ZONE_3: "cloudstack_ci_beta_connection:zone_3"
T_CLOUDSTACK_ACCOUNT: "cloudstack_ci_beta_connection:account"
T_CLOUDSTACK_ACCOUNT_FOR_MULTILEVEL_DOMAIN: "cloudstack_ci_beta_connection:account_for_multilevel_domain"
T_CLOUDSTACK_NETWORK: "cloudstack_ci_beta_connection:network"
T_CLOUDSTACK_NETWORK_2: "cloudstack_ci_beta_connection:network_2"
T_CLOUDSTACK_NETWORK_3: "cloudstack_ci_beta_connection:network_3"
Expand Down
19 changes: 19 additions & 0 deletions test/e2e/cloudstack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4403,3 +4403,22 @@ func TestCloudstackKubernetes127To128RedHatManagementCPUpgradeAPI(t *testing.T)
provider.WithKubeVersionAndOS(v1alpha1.Kube128, framework.RedHat8, nil),
)
}

func TestCloudStackKubernetes128ValidateDomainFourLevelsSimpleFlow(t *testing.T) {
provider := framework.NewCloudStack(
t,
framework.WithCloudStackRedhat128(),
framework.WithCloudStackFillers(
framework.RemoveAllCloudStackAzs(),
framework.UpdateAddCloudStackAz4(),
),
)
test := framework.NewClusterE2ETest(
t,
provider,
framework.WithClusterFiller(
api.WithKubernetesVersion(v1alpha1.Kube128),
),
)
runSimpleFlow(test)
}
63 changes: 36 additions & 27 deletions test/framework/cloudstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,32 @@ import (
)

const (
cloudstackDomainVar = "T_CLOUDSTACK_DOMAIN"
cloudstackZoneVar = "T_CLOUDSTACK_ZONE"
cloudstackZone2Var = "T_CLOUDSTACK_ZONE_2"
cloudstackZone3Var = "T_CLOUDSTACK_ZONE_3"
cloudstackAccountVar = "T_CLOUDSTACK_ACCOUNT"
cloudstackNetworkVar = "T_CLOUDSTACK_NETWORK"
cloudstackNetwork2Var = "T_CLOUDSTACK_NETWORK_2"
cloudstackNetwork3Var = "T_CLOUDSTACK_NETWORK_3"
cloudstackCredentialsVar = "T_CLOUDSTACK_CREDENTIALS"
cloudstackCredentials2Var = "T_CLOUDSTACK_CREDENTIALS_2"
cloudstackCredentials3Var = "T_CLOUDSTACK_CREDENTIALS_3"
cloudstackManagementServerVar = "T_CLOUDSTACK_MANAGEMENT_SERVER"
cloudstackManagementServer2Var = "T_CLOUDSTACK_MANAGEMENT_SERVER_2"
cloudstackManagementServer3Var = "T_CLOUDSTACK_MANAGEMENT_SERVER_3"
cloudstackSshAuthorizedKeyVar = "T_CLOUDSTACK_SSH_AUTHORIZED_KEY"
cloudstackComputeOfferingLargeVar = "T_CLOUDSTACK_COMPUTE_OFFERING_LARGE"
cloudstackComputeOfferingLargerVar = "T_CLOUDSTACK_COMPUTE_OFFERING_LARGER"
cloudStackClusterIPPoolEnvVar = "T_CLOUDSTACK_CLUSTER_IP_POOL"
cloudStackCidrVar = "T_CLOUDSTACK_CIDR"
podCidrVar = "T_CLOUDSTACK_POD_CIDR"
serviceCidrVar = "T_CLOUDSTACK_SERVICE_CIDR"
cloudstackFeatureGateEnvVar = "CLOUDSTACK_PROVIDER"
cloudstackB64EncodedSecretEnvVar = "EKSA_CLOUDSTACK_B64ENCODED_SECRET"
cloudstackDomainVar = "T_CLOUDSTACK_DOMAIN"
cloudstackMultiLevelDomainVar = "T_CLOUDSTACK_MULTILEVEL_DOMAIN" // Not a required env var
cloudstackZoneVar = "T_CLOUDSTACK_ZONE"
cloudstackZone2Var = "T_CLOUDSTACK_ZONE_2"
cloudstackZone3Var = "T_CLOUDSTACK_ZONE_3"
cloudstackAccountVar = "T_CLOUDSTACK_ACCOUNT"
cloudstackAccountForMultiLevelDomainVar = "T_CLOUDSTACK_ACCOUNT_FOR_MULTILEVEL_DOMAIN" // Not a required env var
cloudstackNetworkVar = "T_CLOUDSTACK_NETWORK"
cloudstackNetwork2Var = "T_CLOUDSTACK_NETWORK_2"
cloudstackNetwork3Var = "T_CLOUDSTACK_NETWORK_3"
cloudstackCredentialsVar = "T_CLOUDSTACK_CREDENTIALS"
cloudstackCredentials2Var = "T_CLOUDSTACK_CREDENTIALS_2"
cloudstackCredentials3Var = "T_CLOUDSTACK_CREDENTIALS_3"
cloudstackCredentialsForMultiLevelDomainVar = "T_CLOUDSTACK_CREDENTIALS_FOR_MULTILEVEL_DOMAIN"
cloudstackManagementServerVar = "T_CLOUDSTACK_MANAGEMENT_SERVER"
cloudstackManagementServer2Var = "T_CLOUDSTACK_MANAGEMENT_SERVER_2"
cloudstackManagementServer3Var = "T_CLOUDSTACK_MANAGEMENT_SERVER_3"
cloudstackSSHAuthorizedKeyVar = "T_CLOUDSTACK_SSH_AUTHORIZED_KEY"
cloudstackComputeOfferingLargeVar = "T_CLOUDSTACK_COMPUTE_OFFERING_LARGE"
cloudstackComputeOfferingLargerVar = "T_CLOUDSTACK_COMPUTE_OFFERING_LARGER"
cloudStackClusterIPPoolEnvVar = "T_CLOUDSTACK_CLUSTER_IP_POOL"
cloudStackCidrVar = "T_CLOUDSTACK_CIDR"
podCidrVar = "T_CLOUDSTACK_POD_CIDR"
serviceCidrVar = "T_CLOUDSTACK_SERVICE_CIDR"
cloudstackFeatureGateEnvVar = "CLOUDSTACK_PROVIDER"
cloudstackB64EncodedSecretEnvVar = "EKSA_CLOUDSTACK_B64ENCODED_SECRET"
)

var requiredCloudStackEnvVars = []string{
Expand All @@ -61,7 +64,7 @@ var requiredCloudStackEnvVars = []string{
cloudstackManagementServerVar,
cloudstackManagementServer2Var,
cloudstackManagementServer3Var,
cloudstackSshAuthorizedKeyVar,
cloudstackSSHAuthorizedKeyVar,
cloudstackComputeOfferingLargeVar,
cloudstackComputeOfferingLargerVar,
cloudStackCidrVar,
Expand Down Expand Up @@ -89,7 +92,13 @@ func UpdateLargerCloudStackComputeOffering() api.CloudStackFiller {
return api.WithCloudStackStringFromEnvVar(cloudstackComputeOfferingLargerVar, api.WithCloudStackComputeOfferingForAllMachines)
}

// UpdateAddCloudStackAz3 add availiability zone 3 to the cluster spec.
// UpdateAddCloudStackAz4 add availability zone 4 to the cluster spec.
func UpdateAddCloudStackAz4() api.CloudStackFiller {
return api.WithCloudStackAzFromEnvVars(cloudstackAccountForMultiLevelDomainVar, cloudstackMultiLevelDomainVar, cloudstackZoneVar, cloudstackCredentialsForMultiLevelDomainVar, cloudstackNetworkVar,
cloudstackManagementServerVar, api.WithCloudStackAz)
}

// UpdateAddCloudStackAz3 add availability zone 3 to the cluster spec.
func UpdateAddCloudStackAz3() api.CloudStackFiller {
return api.WithCloudStackAzFromEnvVars(cloudstackAccountVar, cloudstackDomainVar, cloudstackZone3Var, cloudstackCredentials3Var, cloudstackNetwork3Var,
cloudstackManagementServer3Var, api.WithCloudStackAz)
Expand Down Expand Up @@ -124,7 +133,7 @@ func NewCloudStack(t *testing.T, opts ...CloudStackOpt) *CloudStack {
api.RemoveCloudStackAzs(),
api.WithCloudStackAzFromEnvVars(cloudstackAccountVar, cloudstackDomainVar, cloudstackZoneVar, cloudstackCredentialsVar, cloudstackNetworkVar,
cloudstackManagementServerVar, api.WithCloudStackAz),
api.WithCloudStackStringFromEnvVar(cloudstackSshAuthorizedKeyVar, api.WithCloudStackSSHAuthorizedKey),
api.WithCloudStackStringFromEnvVar(cloudstackSSHAuthorizedKeyVar, api.WithCloudStackSSHAuthorizedKey),
api.WithCloudStackStringFromEnvVar(cloudstackComputeOfferingLargeVar, api.WithCloudStackComputeOfferingForAllMachines),
},
}
Expand Down Expand Up @@ -289,7 +298,7 @@ func cloudStackMachineConfig(name string, fillers ...api.CloudStackMachineConfig
// values to all machines have already ran
f = append(f,
api.WithCloudStackComputeOffering(os.Getenv(cloudstackComputeOfferingLargeVar)),
api.WithCloudStackSSHKey(os.Getenv(cloudstackSshAuthorizedKeyVar)),
api.WithCloudStackSSHKey(os.Getenv(cloudstackSSHAuthorizedKeyVar)),
)
f = append(f, fillers...)

Expand Down

0 comments on commit a99d4da

Please sign in to comment.