mirror of
https://github.com/projectcapsule/capsule.git
synced 2026-02-14 18:09:58 +00:00
refactor(test): generating namespace names avoiding collision
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user