Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup CommonBeforeSuite #96

Merged
merged 1 commit into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions hosted/aks/k8s_chart_support/k8s_chart_support_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ var _ = BeforeSuite(func() {

var _ = BeforeEach(func() {
var err error
ctx, err = helpers.CommonBeforeSuite(helpers.Provider)
Expect(err).To(BeNil())
ctx = helpers.CommonBeforeSuite(helpers.Provider)
clusterName = namegen.AppendRandomString(helpers.ClusterNamePrefix)

k8sVersion, err = helper.DefaultAKS(ctx.RancherClient, ctx.CloudCred.ID, location)
Expand Down
3 changes: 1 addition & 2 deletions hosted/aks/p0/p0_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ func TestP0(t *testing.T) {

var _ = BeforeEach(func() {
var err error
ctx, err = helpers.CommonBeforeSuite(helpers.Provider)
Expect(err).To(BeNil())
ctx = helpers.CommonBeforeSuite(helpers.Provider)
clusterName = namegen.AppendRandomString(helpers.ClusterNamePrefix)
k8sVersion, err = helper.GetK8sVersion(ctx.RancherClient, ctx.CloudCred.ID, location)
Expect(err).To(BeNil())
Expand Down
3 changes: 1 addition & 2 deletions hosted/aks/support_matrix/support_matrix_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ var (
func TestSupportMatrix(t *testing.T) {
RegisterFailHandler(Fail)
var err error
ctx, err = helpers.CommonBeforeSuite(helpers.Provider)
Expect(err).To(BeNil())
ctx = helpers.CommonBeforeSuite(helpers.Provider)
availableVersionList, err = helper.ListSingleVariantAKSAvailableVersions(ctx.RancherClient, ctx.CloudCred.ID, location)
Expect(err).To(BeNil())
RunSpecs(t, "SupportMatrix Suite")
Expand Down
3 changes: 1 addition & 2 deletions hosted/eks/k8s_chart_support/k8s_chart_support_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ var _ = BeforeSuite(func() {

var _ = BeforeEach(func() {
var err error
ctx, err = helpers.CommonBeforeSuite(helpers.Provider)
Expect(err).To(BeNil())
ctx = helpers.CommonBeforeSuite(helpers.Provider)
clusterName = namegen.AppendRandomString(helpers.ClusterNamePrefix)
k8sVersion, err = helper.DefaultEKS(ctx.RancherClient)
Expect(err).To(BeNil())
Expand Down
3 changes: 1 addition & 2 deletions hosted/eks/p0/p0_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ func TestP0(t *testing.T) {

var _ = BeforeEach(func() {
var err error
ctx, err = helpers.CommonBeforeSuite(helpers.Provider)
Expect(err).To(BeNil())
ctx = helpers.CommonBeforeSuite(helpers.Provider)
clusterName = namegen.AppendRandomString(helpers.ClusterNamePrefix)
k8sVersion, err = helper.GetK8sVersion(ctx.RancherClient)
Expect(err).To(BeNil())
Expand Down
3 changes: 1 addition & 2 deletions hosted/eks/support_matrix/support_matrix_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ var (
func TestSupportMatrix(t *testing.T) {
RegisterFailHandler(Fail)
var err error
ctx, err = helpers.CommonBeforeSuite(helpers.Provider)
Expect(err).To(BeNil())
ctx = helpers.CommonBeforeSuite(helpers.Provider)
availableVersionList, err = kubernetesversions.ListEKSAllVersions(ctx.RancherClient)
Expect(err).To(BeNil())
Expect(availableVersionList).ToNot(BeEmpty())
Expand Down
3 changes: 1 addition & 2 deletions hosted/gke/k8s_chart_support/k8s_chart_support_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ var _ = BeforeSuite(func() {

var _ = BeforeEach(func() {
var err error
ctx, err = helpers.CommonBeforeSuite(helpers.Provider)
Expect(err).To(BeNil())
ctx = helpers.CommonBeforeSuite(helpers.Provider)
clusterName = namegen.AppendRandomString(helpers.ClusterNamePrefix)

k8sVersion, err = helper.DefaultGKE(ctx.RancherClient, project, ctx.CloudCred.ID, zone, "")
Expand Down
3 changes: 1 addition & 2 deletions hosted/gke/p0/p0_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ func TestP0(t *testing.T) {

var _ = BeforeEach(func() {
var err error
ctx, err = helpers.CommonBeforeSuite(helpers.Provider)
Expect(err).To(BeNil())
ctx = helpers.CommonBeforeSuite(helpers.Provider)
clusterName = namegen.AppendRandomString(helpers.ClusterNamePrefix)
k8sVersion, err = helper.GetK8sVersion(ctx.RancherClient, project, ctx.CloudCred.ID, zone, "")
Expect(err).To(BeNil())
Expand Down
3 changes: 1 addition & 2 deletions hosted/gke/support_matrix/support_matrix_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ var (
func TestSupportMatrix(t *testing.T) {
RegisterFailHandler(Fail)
var err error
ctx, err = helpers.CommonBeforeSuite(helpers.Provider)
Expect(err).To(BeNil())
ctx = helpers.CommonBeforeSuite(helpers.Provider)
availableVersionList, err = helper.ListSingleVariantGKEAvailableVersions(ctx.RancherClient, project, ctx.CloudCred.ID, zone, "")
Expect(err).To(BeNil())
RunSpecs(t, "SupportMatrix Suite")
Expand Down
6 changes: 2 additions & 4 deletions hosted/helpers/helper_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"os"
"os/user"
"strconv"
"strings"

"github.com/blang/semver"
Expand All @@ -28,7 +27,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

func CommonBeforeSuite(cloud string) (Context, error) {
func CommonBeforeSuite(cloud string) Context {

rancherConfig := new(rancher.Config)
Eventually(rancherConfig, "10s").ShouldNot(BeNil())
Expand Down Expand Up @@ -86,13 +85,12 @@ func CommonBeforeSuite(cloud string) (Context, error) {
Expect(err).To(BeNil())
}

clusterCleanup, _ := strconv.ParseBool(os.Getenv("DOWNSTREAM_CLUSTER_CLEANUP"))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unintended removal ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope. clusterCleanup is already defined in structs.go.

return Context{
CloudCred: cloudCredential,
RancherClient: rancherClient,
Session: testSession,
ClusterCleanup: clusterCleanup,
}, nil
}
}

// WaitUntilClusterIsReady waits until the cluster is in a Ready state,
Expand Down