Skip to content

Commit

Permalink
create separate context for clusterctl upgrade tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shysank committed Nov 16, 2021
1 parent 73c13e6 commit ee7a6ed
Showing 1 changed file with 50 additions and 48 deletions.
98 changes: 50 additions & 48 deletions test/e2e/capi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,56 +231,58 @@ var _ = Describe("Running the Cluster API E2E tests", func() {
})

if os.Getenv("LOCAL_ONLY") != "true" {
Context("upgrade from v1alpha3 to v1beta1, and scale workload clusters created in v1alpha3", func() {
BeforeEach(func() {
// Unset resource group and vnet env variables, since we capi test creates 2 clusters,
// and will result in both the clusters using the same vnet and resource group.
Expect(os.Unsetenv(AzureResourceGroup)).To(Succeed())
Expect(os.Unsetenv(AzureVNetName)).To(Succeed())

// Set base64 encoded values for v1alpha3 cluster.
Expect(os.Setenv("AZURE_CLIENT_ID_B64", base64.StdEncoding.EncodeToString([]byte(os.Getenv(AzureClientId))))).To(Succeed())
Expect(os.Setenv("AZURE_CLIENT_SECRET_B64", base64.StdEncoding.EncodeToString([]byte(os.Getenv(AzureClientSecret))))).To(Succeed())
Expect(os.Setenv("AZURE_SUBSCRIPTION_ID_B64", base64.StdEncoding.EncodeToString([]byte(os.Getenv("AZURE_SUBSCRIPTION_ID"))))).To(Succeed())
Expect(os.Setenv("AZURE_TENANT_ID_B64", base64.StdEncoding.EncodeToString([]byte(os.Getenv("AZURE_TENANT_ID"))))).To(Succeed())

// Unset windows specific variables
Expect(os.Unsetenv("WINDOWS_WORKER_MACHINE_COUNT")).To(Succeed())
Expect(os.Unsetenv("K8S_FEATURE_GATES")).To(Succeed())
Context("API Version Upgrade", func() {
Context("upgrade from v1alpha3 to v1beta1, and scale workload clusters created in v1alpha3 ", func() {
BeforeEach(func() {
// Unset resource group and vnet env variables, since we capi test creates 2 clusters,
// and will result in both the clusters using the same vnet and resource group.
Expect(os.Unsetenv(AzureResourceGroup)).To(Succeed())
Expect(os.Unsetenv(AzureVNetName)).To(Succeed())

// Set base64 encoded values for v1alpha3 cluster.
Expect(os.Setenv("AZURE_CLIENT_ID_B64", base64.StdEncoding.EncodeToString([]byte(os.Getenv(AzureClientId))))).To(Succeed())
Expect(os.Setenv("AZURE_CLIENT_SECRET_B64", base64.StdEncoding.EncodeToString([]byte(os.Getenv(AzureClientSecret))))).To(Succeed())
Expect(os.Setenv("AZURE_SUBSCRIPTION_ID_B64", base64.StdEncoding.EncodeToString([]byte(os.Getenv("AZURE_SUBSCRIPTION_ID"))))).To(Succeed())
Expect(os.Setenv("AZURE_TENANT_ID_B64", base64.StdEncoding.EncodeToString([]byte(os.Getenv("AZURE_TENANT_ID"))))).To(Succeed())

// Unset windows specific variables
Expect(os.Unsetenv("WINDOWS_WORKER_MACHINE_COUNT")).To(Succeed())
Expect(os.Unsetenv("K8S_FEATURE_GATES")).To(Succeed())
})
capi_e2e.ClusterctlUpgradeSpec(ctx, func() capi_e2e.ClusterctlUpgradeSpecInput {
return capi_e2e.ClusterctlUpgradeSpecInput{
E2EConfig: e2eConfig,
ClusterctlConfigPath: clusterctlConfigPath,
BootstrapClusterProxy: bootstrapClusterProxy,
ArtifactFolder: artifactFolder,
SkipCleanup: skipCleanup,
}
})
})
capi_e2e.ClusterctlUpgradeSpec(ctx, func() capi_e2e.ClusterctlUpgradeSpecInput {
return capi_e2e.ClusterctlUpgradeSpecInput{
E2EConfig: e2eConfig,
ClusterctlConfigPath: clusterctlConfigPath,
BootstrapClusterProxy: bootstrapClusterProxy,
ArtifactFolder: artifactFolder,
SkipCleanup: skipCleanup,
}
})
})

Context("upgrade from v1alpha4 to v1beta1, and scale workload clusters created in v1alpha4", func() {
BeforeEach(func() {
// Unset resource group and vnet env variables, since we capi test creates 2 clusters,
// and will result in both the clusters using the same vnet and resource group.
Expect(os.Unsetenv(AzureResourceGroup)).To(Succeed())
Expect(os.Unsetenv(AzureVNetName)).To(Succeed())

// Unset windows specific variables
Expect(os.Unsetenv("WINDOWS_WORKER_MACHINE_COUNT")).To(Succeed())
Expect(os.Unsetenv("K8S_FEATURE_GATES")).To(Succeed())
})
capi_e2e.ClusterctlUpgradeSpec(ctx, func() capi_e2e.ClusterctlUpgradeSpecInput {
return capi_e2e.ClusterctlUpgradeSpecInput{
E2EConfig: e2eConfig,
ClusterctlConfigPath: clusterctlConfigPath,
BootstrapClusterProxy: bootstrapClusterProxy,
ArtifactFolder: artifactFolder,
SkipCleanup: skipCleanup,
InitWithProvidersContract: "v1alpha4",
InitWithBinary: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v0.4.4/clusterctl-{OS}-{ARCH}",
PreInit: getPreInitFunc(ctx),
}
Context("upgrade from v1alpha4 to v1beta1, and scale workload clusters created in v1alpha4", func() {
BeforeEach(func() {
// Unset resource group and vnet env variables, since we capi test creates 2 clusters,
// and will result in both the clusters using the same vnet and resource group.
Expect(os.Unsetenv(AzureResourceGroup)).To(Succeed())
Expect(os.Unsetenv(AzureVNetName)).To(Succeed())

// Unset windows specific variables
Expect(os.Unsetenv("WINDOWS_WORKER_MACHINE_COUNT")).To(Succeed())
Expect(os.Unsetenv("K8S_FEATURE_GATES")).To(Succeed())
})
capi_e2e.ClusterctlUpgradeSpec(ctx, func() capi_e2e.ClusterctlUpgradeSpecInput {
return capi_e2e.ClusterctlUpgradeSpecInput{
E2EConfig: e2eConfig,
ClusterctlConfigPath: clusterctlConfigPath,
BootstrapClusterProxy: bootstrapClusterProxy,
ArtifactFolder: artifactFolder,
SkipCleanup: skipCleanup,
InitWithProvidersContract: "v1alpha4",
InitWithBinary: "https://github.com/kubernetes-sigs/cluster-api/releases/download/v0.4.4/clusterctl-{OS}-{ARCH}",
PreInit: getPreInitFunc(ctx),
}
})
})
})
}
Expand Down

0 comments on commit ee7a6ed

Please sign in to comment.