Skip to content
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: 2 additions & 1 deletion internal/controllers/floatingip/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
utilrand "k8s.io/apimachinery/pkg/util/rand"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/rest"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down Expand Up @@ -82,7 +83,7 @@ var _ = Describe("EnvTest sanity check", func() {
It("should be able to create a namespace", func() {
ctx := context.TODO()
namespace := &corev1.Namespace{}
namespace.SetGenerateName("test-")
namespace.SetName("test-" + utilrand.String(10))

// Create the namespace
Expect(k8sClient.Create(ctx, namespace)).To(Succeed(), "create namespace")
Expand Down
3 changes: 2 additions & 1 deletion internal/controllers/image/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
utilrand "k8s.io/apimachinery/pkg/util/rand"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/rest"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down Expand Up @@ -82,7 +83,7 @@ var _ = Describe("EnvTest sanity check", func() {
It("should be able to create a namespace", func() {
ctx := context.TODO()
namespace := &corev1.Namespace{}
namespace.SetGenerateName("test-")
namespace.SetName("test-" + utilrand.String(10))

// Create the namespace
Expect(k8sClient.Create(ctx, namespace)).To(Succeed(), "create namespace")
Expand Down
3 changes: 2 additions & 1 deletion internal/controllers/image/upload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
. "github.com/onsi/gomega"
"go.uber.org/mock/gomock"
corev1 "k8s.io/api/core/v1"
utilrand "k8s.io/apimachinery/pkg/util/rand"
ctrl "sigs.k8s.io/controller-runtime"

orcv1alpha1 "github.com/k-orc/openstack-resource-controller/v2/api/v1alpha1"
Expand Down Expand Up @@ -158,7 +159,7 @@ var _ = Describe("Upload tests", Ordered, func() {

// Create the namespace
namespace = &corev1.Namespace{}
namespace.SetGenerateName("test-")
namespace.SetName("test-" + utilrand.String(10))
Expect(k8sClient.Create(ctx, namespace)).To(Succeed(), "create namespace")
DeferCleanup(func() {
Expect(k8sClient.Delete(ctx, namespace)).To(Succeed(), "delete namespace")
Expand Down
3 changes: 2 additions & 1 deletion internal/controllers/router/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
utilrand "k8s.io/apimachinery/pkg/util/rand"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/rest"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down Expand Up @@ -82,7 +83,7 @@ var _ = Describe("EnvTest sanity check", func() {
It("should be able to create a namespace", func() {
ctx := context.TODO()
namespace := &corev1.Namespace{}
namespace.SetGenerateName("test-")
namespace.SetName("test-" + utilrand.String(10))

// Create the namespace
Expect(k8sClient.Create(ctx, namespace)).To(Succeed(), "create namespace")
Expand Down
3 changes: 2 additions & 1 deletion internal/controllers/routerinterface/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
utilrand "k8s.io/apimachinery/pkg/util/rand"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/rest"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down Expand Up @@ -82,7 +83,7 @@ var _ = Describe("EnvTest sanity check", func() {
It("should be able to create a namespace", func() {
ctx := context.TODO()
namespace := &corev1.Namespace{}
namespace.SetGenerateName("test-")
namespace.SetName("test-" + utilrand.String(10))

// Create the namespace
Expect(k8sClient.Create(ctx, namespace)).To(Succeed(), "create namespace")
Expand Down
3 changes: 2 additions & 1 deletion internal/controllers/subnet/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
utilrand "k8s.io/apimachinery/pkg/util/rand"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/rest"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down Expand Up @@ -82,7 +83,7 @@ var _ = Describe("EnvTest sanity check", func() {
It("should be able to create a namespace", func() {
ctx := context.TODO()
namespace := &corev1.Namespace{}
namespace.SetGenerateName("test-")
namespace.SetName("test-" + utilrand.String(10))

// Create the namespace
Expect(k8sClient.Create(ctx, namespace)).To(Succeed(), "create namespace")
Expand Down
4 changes: 3 additions & 1 deletion test/apivalidations/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import (
"testing"
"time"

utilrand "k8s.io/apimachinery/pkg/util/rand"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -147,7 +149,7 @@ var _ = BeforeSuite(func() {
func createNamespace() *corev1.Namespace {
By("Creating namespace")
namespace := corev1.Namespace{}
namespace.GenerateName = "test-"
namespace.Name = "test-" + utilrand.String(10)
Expect(k8sClient.Create(ctx, &namespace)).To(Succeed(), "Namespace creation should succeed")
DeferCleanup(func() {
By("Deleting namespace")
Expand Down
Loading