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
5 changes: 3 additions & 2 deletions test/e2e/data/atlascluster_basic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ spec:
projectRef:
name: my-project
providerSettings:
instanceSizeName: M10
providerName: AWS
instanceSizeName: M2
providerName: TENANT
regionName: US_EAST_1
backingProviderName: AWS
5 changes: 3 additions & 2 deletions test/e2e/data/atlascluster_basic_update.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ spec:
projectRef:
name: my-project
providerSettings:
instanceSizeName: M20
providerName: AWS
instanceSizeName: M5
providerName: TENANT
regionName: US_EAST_1
backingProviderName: AWS
2 changes: 1 addition & 1 deletion test/int/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down
2 changes: 1 addition & 1 deletion test/int/clusterwide/dbuser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
22 changes: 11 additions & 11 deletions test/int/dbuser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()),
Expand Down Expand Up @@ -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()),
Expand Down Expand Up @@ -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()),
Expand Down Expand Up @@ -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()),
Expand Down