From 6c9139c6229d1a0179b9868fc079c400c4079fa6 Mon Sep 17 00:00:00 2001 From: Svetlana Maltseva <5437289+leo-ri@users.noreply.github.com> Date: Wed, 28 Jul 2021 11:06:57 +0300 Subject: [PATCH] revert temporary changes (TENANT) --- test/e2e/data/atlascluster_basic.yaml | 5 +++-- test/e2e/data/atlascluster_basic_update.yaml | 5 +++-- test/int/cluster_test.go | 2 +- test/int/clusterwide/dbuser_test.go | 2 +- test/int/dbuser_test.go | 22 ++++++++++---------- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/test/e2e/data/atlascluster_basic.yaml b/test/e2e/data/atlascluster_basic.yaml index db1690cab3..98541a977a 100644 --- a/test/e2e/data/atlascluster_basic.yaml +++ b/test/e2e/data/atlascluster_basic.yaml @@ -7,6 +7,7 @@ spec: projectRef: name: my-project providerSettings: - instanceSizeName: M10 - providerName: AWS + instanceSizeName: M2 + providerName: TENANT regionName: US_EAST_1 + backingProviderName: AWS diff --git a/test/e2e/data/atlascluster_basic_update.yaml b/test/e2e/data/atlascluster_basic_update.yaml index 219c0c9a6e..a254ad61ab 100644 --- a/test/e2e/data/atlascluster_basic_update.yaml +++ b/test/e2e/data/atlascluster_basic_update.yaml @@ -7,6 +7,7 @@ spec: projectRef: name: my-project providerSettings: - instanceSizeName: M20 - providerName: AWS + instanceSizeName: M5 + providerName: TENANT regionName: US_EAST_1 + backingProviderName: AWS diff --git a/test/int/cluster_test.go b/test/int/cluster_test.go index e78ea65e46..5632faaf80 100644 --- a/test/int/cluster_test.go +++ b/test/int/cluster_test.go @@ -596,7 +596,7 @@ var _ = Describe("AtlasCluster", func() { Describe("Deleting the cluster (not cleaning Atlas)", func() { It("Should Succeed", func() { By(`Creating the cluster with retention policy "keep" first`, func() { - createdCluster = mdbv1.DefaultAWSCluster(namespace.Name, createdProject.Name) + createdCluster = mdbv1.DefaultAWSCluster(namespace.Name, createdProject.Name).Lightweight() createdCluster.ObjectMeta.Annotations = map[string]string{customresource.ResourcePolicyAnnotation: customresource.ResourcePolicyKeep} Expect(k8sClient.Create(context.Background(), createdCluster)).ToNot(HaveOccurred()) diff --git a/test/int/clusterwide/dbuser_test.go b/test/int/clusterwide/dbuser_test.go index e0d505a7d3..52d47f56ee 100644 --- a/test/int/clusterwide/dbuser_test.go +++ b/test/int/clusterwide/dbuser_test.go @@ -105,7 +105,7 @@ var _ = Describe("ClusterWide", func() { passwordSecret := buildPasswordSecret(userNS.Name, UserPasswordSecret, DBUserPassword) Expect(k8sClient.Create(context.Background(), &passwordSecret)).To(Succeed()) - createdClusterAWS = mdbv1.DefaultAWSCluster(clusterNS.Name, createdProject.Name) + createdClusterAWS = mdbv1.DefaultAWSCluster(clusterNS.Name, createdProject.Name).Lightweight() // The project namespace is different from the cluster one - need to specify explicitly createdClusterAWS.Spec.Project.Namespace = namespace.Name diff --git a/test/int/dbuser_test.go b/test/int/dbuser_test.go index 589dc0e79a..1c84d29ca4 100644 --- a/test/int/dbuser_test.go +++ b/test/int/dbuser_test.go @@ -151,10 +151,10 @@ var _ = Describe("AtlasDatabaseUser", func() { Describe("Create/Update two users, two clusters", func() { It("They should be created successfully", func() { By("Creating clusters", func() { - createdClusterAWS = mdbv1.DefaultAWSCluster(namespace.Name, createdProject.Name) + createdClusterAWS = mdbv1.DefaultAWSCluster(namespace.Name, createdProject.Name).Lightweight() Expect(k8sClient.Create(context.Background(), createdClusterAWS)).ToNot(HaveOccurred()) - createdClusterAzure = mdbv1.DefaultAzureCluster(namespace.Name, createdProject.Name) + createdClusterAzure = mdbv1.DefaultAzureCluster(namespace.Name, createdProject.Name).Lightweight() Expect(k8sClient.Create(context.Background(), createdClusterAzure)).ToNot(HaveOccurred()) Eventually(testutil.WaitFor(k8sClient, createdClusterAWS, status.TrueCondition(status.ReadyType), validateClusterCreatingFunc()), @@ -184,11 +184,11 @@ var _ = Describe("AtlasDatabaseUser", func() { // The user created lacks read/write roles err := tryWrite(createdProject.ID(), *createdClusterAzure, *createdDBUser, "test", "operatortest") Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(MatchRegexp("not authorized on test to execute command")) // TODO check this is the same "user is not allowed" + Expect(err.Error()).To(MatchRegexp("user is not allowed")) err = tryWrite(createdProject.ID(), *createdClusterAWS, *createdDBUser, "test", "operatortest") Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(MatchRegexp("not authorized on test to execute command")) // TODO check this is the same "user is not allowed" + Expect(err.Error()).To(MatchRegexp("user is not allowed")) }) }) By("Update database user - give readWrite permissions", func() { @@ -267,7 +267,7 @@ var _ = Describe("AtlasDatabaseUser", func() { err := tryWrite(createdProject.ID(), *createdClusterAzure, *secondDBUser, "test", "someNotAllowedCollection") Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(MatchRegexp("not authorized on test to execute command")) // TODO check this is the same "user is not allowed" + Expect(err.Error()).To(MatchRegexp("user is not allowed")) }) By("Removing Second user", func() { Expect(k8sClient.Delete(context.Background(), secondDBUser)).To(Succeed()) @@ -305,7 +305,7 @@ var _ = Describe("AtlasDatabaseUser", func() { checkNumberOfConnectionSecrets(k8sClient, *createdProject, 0) }) By("Creating cluster", func() { - createdClusterAWS = mdbv1.DefaultAWSCluster(namespace.Name, createdProject.Name) + createdClusterAWS = mdbv1.DefaultAWSCluster(namespace.Name, createdProject.Name).Lightweight() Expect(k8sClient.Create(context.Background(), createdClusterAWS)).ToNot(HaveOccurred()) // We don't wait for the full cluster creation - only when it has started the process @@ -338,7 +338,7 @@ var _ = Describe("AtlasDatabaseUser", func() { Describe("Check the password Secret is watched", func() { It("Should succeed", func() { By("Creating clusters", func() { - createdClusterAWS = mdbv1.DefaultAWSCluster(namespace.Name, createdProject.Name) + createdClusterAWS = mdbv1.DefaultAWSCluster(namespace.Name, createdProject.Name).Lightweight() Expect(k8sClient.Create(context.Background(), createdClusterAWS)).ToNot(HaveOccurred()) Eventually(testutil.WaitFor(k8sClient, createdClusterAWS, status.TrueCondition(status.ReadyType), validateClusterCreatingFunc()), @@ -394,10 +394,10 @@ var _ = Describe("AtlasDatabaseUser", func() { Describe("Change database users (make sure all stale secrets are removed)", func() { It("Should succeed", func() { By("Creating AWS and Azure clusters", func() { - createdClusterAWS = mdbv1.DefaultAWSCluster(namespace.Name, createdProject.Name) + createdClusterAWS = mdbv1.DefaultAWSCluster(namespace.Name, createdProject.Name).Lightweight() Expect(k8sClient.Create(context.Background(), createdClusterAWS)).ToNot(HaveOccurred()) - createdClusterAzure = mdbv1.DefaultAzureCluster(namespace.Name, createdProject.Name) + createdClusterAzure = mdbv1.DefaultAzureCluster(namespace.Name, createdProject.Name).Lightweight() Expect(k8sClient.Create(context.Background(), createdClusterAzure)).ToNot(HaveOccurred()) Eventually(testutil.WaitFor(k8sClient, createdClusterAWS, status.TrueCondition(status.ReadyType), validateClusterCreatingFunc()), @@ -463,7 +463,7 @@ var _ = Describe("AtlasDatabaseUser", func() { Describe("Check the user expiration", func() { It("Should succeed", func() { By("Creating a AWS cluster", func() { - createdClusterAWS = mdbv1.DefaultAWSCluster(namespace.Name, createdProject.Name) + createdClusterAWS = mdbv1.DefaultAWSCluster(namespace.Name, createdProject.Name).Lightweight() Expect(k8sClient.Create(context.Background(), createdClusterAWS)).To(Succeed()) Eventually(testutil.WaitFor(k8sClient, createdClusterAWS, status.TrueCondition(status.ReadyType), validateClusterCreatingFunc()), @@ -529,7 +529,7 @@ var _ = Describe("AtlasDatabaseUser", func() { Describe("Deleting the db user (not cleaning Atlas)", func() { It("Should Succeed", func() { By(`Creating the db user with retention policy "keep" first`, func() { - createdClusterAWS = mdbv1.DefaultAWSCluster(namespace.Name, createdProject.Name) + createdClusterAWS = mdbv1.DefaultAWSCluster(namespace.Name, createdProject.Name).Lightweight() Expect(k8sClient.Create(context.Background(), createdClusterAWS)).ToNot(HaveOccurred()) Eventually(testutil.WaitFor(k8sClient, createdClusterAWS, status.TrueCondition(status.ReadyType), validateClusterCreatingFunc()),