Skip to content

Commit

Permalink
Aim for namespace uniqueness across parallel specs (#7680)
Browse files Browse the repository at this point in the history
ensure namespace uniqueness across parallel specs
  • Loading branch information
TiberiuGC committed Mar 22, 2024
1 parent 53aa373 commit 78e6711
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions integration/utilities/kube/kube.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@
package kube

import (
"fmt"

harness "github.com/dlespiau/kube-test-harness"
"github.com/dlespiau/kube-test-harness/logger"
"github.com/google/uuid"
"github.com/onsi/ginkgo/v2"
)

type tHelper struct{ ginkgo.FullGinkgoTInterface }

func (t *tHelper) Helper() {}
func (t *tHelper) Name() string { return "eksctl-test" }
func (t *tHelper) Name() string { return "eksctl" }

// NewTest creates a new test harness to more easily run integration tests against the provided Kubernetes cluster.
func NewTest(kubeconfigPath string) (*harness.Test, error) {
Expand All @@ -28,7 +27,9 @@ func NewTest(kubeconfigPath string) (*harness.Test, error) {
return nil, err
}
test := h.NewTest(t)
test.Namespace += fmt.Sprintf("-%d", t.ParallelProcess())
// several parallel test specs may initialize a new harness and close it after completion,
// thus, we aim to minimize the chance of conflicting actions against same K8s namespace
test.Namespace += uuid.NewString()
test.Setup()
return test, nil
}

0 comments on commit 78e6711

Please sign in to comment.