From 4ae0733ec153ec8b34dc46ffc63224d37e99b5c9 Mon Sep 17 00:00:00 2001 From: fabriziopandini Date: Fri, 15 Jan 2021 17:52:05 +0100 Subject: [PATCH] use different CRS for each test --- .../clusterresourceset_controller_test.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/exp/addons/controllers/clusterresourceset_controller_test.go b/exp/addons/controllers/clusterresourceset_controller_test.go index 48442d6fc6bd..6cad4b75bc53 100644 --- a/exp/addons/controllers/clusterresourceset_controller_test.go +++ b/exp/addons/controllers/clusterresourceset_controller_test.go @@ -34,12 +34,14 @@ import ( ) const ( - timeout = time.Second * 20 + timeout = time.Second * 10 defaultNamespaceName = "default" ) var _ = Describe("ClusterResourceSet Reconciler", func() { + var clusterResourceSetName string + var testCluster *clusterv1.Cluster var clusterName string @@ -47,6 +49,8 @@ var _ = Describe("ClusterResourceSet Reconciler", func() { var configmap2Name = "test-configmap2" BeforeEach(func() { + clusterResourceSetName = fmt.Sprintf("clusterresourceset-%s", util.RandomString(6)) + clusterName = fmt.Sprintf("cluster-%s", util.RandomString(6)) testCluster = &clusterv1.Cluster{ObjectMeta: metav1.ObjectMeta{Name: clusterName, Namespace: defaultNamespaceName}} @@ -99,7 +103,7 @@ metadata: clusterResourceSetInstance := &addonsv1.ClusterResourceSet{ ObjectMeta: metav1.ObjectMeta{ - Name: "test-clusterresourceset", + Name: clusterResourceSetName, Namespace: defaultNamespaceName, }, } @@ -129,7 +133,7 @@ metadata: By("Creating a ClusterResourceSet instance that has same labels as selector") clusterResourceSetInstance := &addonsv1.ClusterResourceSet{ ObjectMeta: metav1.ObjectMeta{ - Name: "test-clusterresourceset", + Name: clusterResourceSetName, Namespace: defaultNamespaceName, }, Spec: addonsv1.ClusterResourceSetSpec{ @@ -181,7 +185,7 @@ metadata: clusterResourceSetInstance := &addonsv1.ClusterResourceSet{ ObjectMeta: metav1.ObjectMeta{ - Name: "test-clusterresourceset", + Name: clusterResourceSetName, Namespace: defaultNamespaceName, }, Spec: addonsv1.ClusterResourceSetSpec{ @@ -243,7 +247,7 @@ metadata: clusterResourceSetInstance := &addonsv1.ClusterResourceSet{ ObjectMeta: metav1.ObjectMeta{ - Name: "test-clusterresourceset", + Name: clusterResourceSetName, Namespace: defaultNamespaceName, }, Spec: addonsv1.ClusterResourceSetSpec{ @@ -317,7 +321,7 @@ metadata: By("Creating a ClusterResourceSet instance that has same labels as selector") clusterResourceSetInstance2 := &addonsv1.ClusterResourceSet{ ObjectMeta: metav1.ObjectMeta{ - Name: "test-clusterresourceset", + Name: clusterResourceSetName, Namespace: defaultNamespaceName, }, Spec: addonsv1.ClusterResourceSetSpec{ @@ -396,7 +400,7 @@ metadata: labels := map[string]string{"foo": "bar"} clusterResourceSetInstance := &addonsv1.ClusterResourceSet{ ObjectMeta: metav1.ObjectMeta{ - Name: "test-clusterresourceset", + Name: clusterResourceSetName, Namespace: defaultNamespaceName, Finalizers: []string{addonsv1.ClusterResourceSetFinalizer}, DeletionTimestamp: &dt,