Skip to content

Commit

Permalink
Add cleanup to reset security group on aigrapped registry mirror dock…
Browse files Browse the repository at this point in the history
…er tests (#7245)
  • Loading branch information
cxbrowne1207 authored Jan 2, 2024
1 parent 48435f1 commit d349dc5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/e2e/airgap.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,14 @@ func runDockerAirgapConfigFlow(test *framework.ClusterE2ETest) {
test.ExtractDownloadedArtifacts()
test.DownloadImages()
test.ChangeInstanceSecurityGroup(os.Getenv(framework.RegistryMirrorAirgappedSecurityGroup))
test.SetRegistryMirrorDefaultInstanceSecurityGroupOnCleanup()
test.ImportImages()
test.CreateCluster(framework.WithBundlesOverride(bundleReleasePathFromArtifacts))
test.DeleteCluster(framework.WithBundlesOverride(bundleReleasePathFromArtifacts))
test.ChangeInstanceSecurityGroup(os.Getenv(framework.RegistryMirrorDefaultSecurityGroup))
}

func runDockerAirgapUpgradeFromReleaseFlow(test *framework.ClusterE2ETest, latestRelease *releasev1.EksARelease, wantVersion anywherev1.KubernetesVersion) {
test.SetRegistryMirrorDefaultInstanceSecurityGroupOnCleanup()
test.GenerateClusterConfigForVersion(latestRelease.Version, framework.ExecuteWithEksaRelease(latestRelease))

// Downloading and importing the artifacts from the previous version
Expand All @@ -214,11 +215,11 @@ func runDockerAirgapUpgradeFromReleaseFlow(test *framework.ClusterE2ETest, lates
test.ExtractDownloadedArtifacts()
test.DownloadImages()
test.ChangeInstanceSecurityGroup(os.Getenv(framework.RegistryMirrorAirgappedSecurityGroup))
test.SetRegistryMirrorDefaultInstanceSecurityGroupOnCleanup()
test.ImportImages()

test.UpgradeClusterWithNewConfig([]framework.ClusterE2ETestOpt{}, framework.WithBundlesOverride(bundleReleasePathFromArtifacts))
test.ValidateCluster(wantVersion)
test.StopIfFailed()
test.DeleteCluster(framework.WithBundlesOverride(bundleReleasePathFromArtifacts))
test.ChangeInstanceSecurityGroup(os.Getenv(framework.RegistryMirrorDefaultSecurityGroup))
}
7 changes: 7 additions & 0 deletions test/framework/registry_mirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,10 @@ func setupRegistryMirrorEndpointAndCert(e *ClusterE2ETest, providerName string,
e.T.Fatalf("unable to set REGISTRY_PASSWORD: %v", err)
}
}

// SetRegistryMirrorDefaultInstanceSecurityGroupOnCleanup sets the instance security group to the registry mirror default security group on cleanup.
func (e *ClusterE2ETest) SetRegistryMirrorDefaultInstanceSecurityGroupOnCleanup(opts ...CommandOpt) {
e.T.Cleanup(func() {
e.ChangeInstanceSecurityGroup(os.Getenv(RegistryMirrorDefaultSecurityGroup))
})
}

0 comments on commit d349dc5

Please sign in to comment.