@@ -89,7 +89,6 @@ var _ = Describe("AtlasCluster", func() {
8989 )))
9090 Expect (createdCluster .Status .ObservedGeneration ).To (Equal (createdCluster .Generation ))
9191 Expect (createdCluster .Status .ObservedGeneration ).To (Equal (lastGeneration + 1 ))
92- lastGeneration ++
9392 })
9493 }
9594
@@ -119,7 +118,7 @@ var _ = Describe("AtlasCluster", func() {
119118 Eventually (testutil .WaitFor (k8sClient , createdCluster , status .TrueCondition (status .ReadyType ), validateClusterUpdatingFunc ()),
120119 1200 , interval ).Should (BeTrue ())
121120
122- doCommonChecks ()
121+ lastGeneration ++
123122 }
124123
125124 Describe ("Create/Update the cluster" , func () {
@@ -142,12 +141,14 @@ var _ = Describe("AtlasCluster", func() {
142141 By ("Updating the Cluster labels" , func () {
143142 createdCluster .Spec .Labels = []mdbv1.LabelSpec {{Key : "int-test" , Value : "true" }}
144143 performUpdate ()
144+ doCommonChecks ()
145145 checkAtlasState ()
146146 })
147147
148148 By ("Updating the Cluster backups settings" , func () {
149149 createdCluster .Spec .ProviderBackupEnabled = boolptr (true )
150150 performUpdate ()
151+ doCommonChecks ()
151152 checkAtlasState (func (c * mongodbatlas.Cluster ) {
152153 Expect (c .ProviderBackupEnabled ).To (Equal (createdCluster .Spec .ProviderBackupEnabled ))
153154 })
@@ -156,13 +157,52 @@ var _ = Describe("AtlasCluster", func() {
156157 By ("Decreasing the Cluster disk size" , func () {
157158 createdCluster .Spec .DiskSizeGB = intptr (10 )
158159 performUpdate ()
160+ doCommonChecks ()
159161 checkAtlasState (func (c * mongodbatlas.Cluster ) {
160162 Expect (* c .DiskSizeGB ).To (BeEquivalentTo (* createdCluster .Spec .DiskSizeGB ))
161163
162164 // check whether https://github.com/mongodb/go-client-mongodb-atlas/issues/140 is fixed
163165 Expect (c .DiskSizeGB ).To (BeAssignableToTypeOf (float64ptr (0 )), "DiskSizeGB is no longer a *float64, please check the spec!" )
164166 })
165167 })
168+
169+ By ("Pausing the cluster" , func () {
170+ createdCluster .Spec .Paused = boolptr (true )
171+ performUpdate ()
172+ doCommonChecks ()
173+ checkAtlasState (func (c * mongodbatlas.Cluster ) {
174+ Expect (c .Paused ).To (Equal (createdCluster .Spec .Paused ))
175+ })
176+ })
177+
178+ By ("Updating the Cluster configuration while paused (should fail)" , func () {
179+ createdCluster .Spec .ProviderBackupEnabled = boolptr (false )
180+
181+ Expect (k8sClient .Update (context .Background (), createdCluster )).To (Succeed ())
182+ Eventually (
183+ testutil .WaitFor (k8sClient , createdCluster , status .FalseCondition (status .ClusterReadyType ).WithReason (string (workflow .ClusterNotCreatedInAtlas ))),
184+ 60 ,
185+ interval ,
186+ ).Should (BeTrue ())
187+
188+ lastGeneration ++
189+ })
190+
191+ By ("Unpausing the cluster" , func () {
192+ createdCluster .Spec .Paused = boolptr (false )
193+ performUpdate ()
194+ doCommonChecks ()
195+ checkAtlasState (func (c * mongodbatlas.Cluster ) {
196+ Expect (c .Paused ).To (Equal (createdCluster .Spec .Paused ))
197+ })
198+ })
199+
200+ By ("Checking that modifications were applied after unpausing" , func () {
201+ doCommonChecks ()
202+ checkAtlasState (func (c * mongodbatlas.Cluster ) {
203+ Expect (c .ProviderBackupEnabled ).To (Equal (createdCluster .Spec .ProviderBackupEnabled ))
204+ })
205+ })
166206 })
167207 })
168208})
@@ -200,7 +240,7 @@ func validateClusterUpdatingFunc() func(a mdbv1.AtlasCustomResource) {
200240 }
201241 // When the create request has been made to Atlas - we expect the following status
202242 if ! isIdle {
203- Expect (c .Status .StateName ).To (Equal ("UPDATING" ), fmt .Sprintf ("Current conditions: %+v" , c .Status .Conditions ))
243+ Expect (c .Status .StateName ).To (Or ( Equal ("UPDATING" ), Equal ( "REPAIRING" ) ), fmt .Sprintf ("Current conditions: %+v" , c .Status .Conditions ))
204244 expectedConditionsMatchers := testutil .MatchConditions (
205245 status .FalseCondition (status .ClusterReadyType ).WithReason (string (workflow .ClusterUpdating )).WithMessageRegexp ("cluster is updating" ),
206246 status .FalseCondition (status .ReadyType ),
0 commit comments