refactor(test): generating namespace names avoiding collision

This commit is contained in:
Dario Tranchitella
2022-10-28 17:57:48 -04:00
parent 369feb23c6
commit 6403b60590
33 changed files with 87 additions and 80 deletions

View File

@@ -8,10 +8,12 @@ package e2e
import (
"context"
"fmt"
"sigs.k8s.io/controller-runtime/pkg/client"
"strings"
"time"
"k8s.io/apimachinery/pkg/util/rand"
"sigs.k8s.io/controller-runtime/pkg/client"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
@@ -31,6 +33,10 @@ const (
)
func NewNamespace(name string) *corev1.Namespace {
if len(name) == 0 {
name = rand.String(10)
}
return &corev1.Namespace{
ObjectMeta: metav1.ObjectMeta{
Name: name,