@@ -408,3 +408,59 @@ def test_state_field_flapping(
408
408
assert "PendingModifiedValues" in latest
409
409
assert "MultiAZ" in latest ["PendingModifiedValues" ]
410
410
assert bool (latest ["PendingModifiedValues" ]["MultiAZ" ])
411
+
412
+ def test_crud_postgres14_update_multiAZ (
413
+ self ,
414
+ postgres14_t3_micro_instance ,
415
+ ):
416
+ (ref , cr , _ ) = postgres14_t3_micro_instance
417
+ db_instance_id = cr ["spec" ]["dbInstanceIdentifier" ]
418
+
419
+ assert 'status' in cr
420
+ assert 'dbInstanceStatus' in cr ['status' ]
421
+ assert cr ['status' ]['dbInstanceStatus' ] == 'creating'
422
+ condition .assert_not_synced (ref )
423
+
424
+ # Assert that the last-applied-secret-reference annotation is set
425
+ assert 'metadata' in cr
426
+ assert 'annotations' in cr ['metadata' ]
427
+ assert 'rds.services.k8s.aws/last-applied-secret-reference' in cr ['metadata' ]['annotations' ]
428
+
429
+ # Wait for the resource to get synced
430
+ assert k8s .wait_on_condition (ref , "ACK.ResourceSynced" , "True" , wait_periods = MAX_WAIT_FOR_SYNCED_MINUTES )
431
+
432
+ # After the resource is synced, assert that DBInstanceStatus is available
433
+ latest = db_instance .get (db_instance_id )
434
+ assert latest is not None
435
+ assert latest ['DBInstanceStatus' ] == 'available'
436
+ assert latest ['MultiAZ' ] is False
437
+
438
+ cr = k8s .get_resource (ref )
439
+ assert cr is not None
440
+ assert 'spec' in cr
441
+ assert 'multiAZ' in cr ['spec' ]
442
+ assert cr ['spec' ]['multiAZ' ] is False
443
+ condition .assert_synced (ref )
444
+
445
+ # Let's now update the DBInstance MultiAZ to be true
446
+ updates = {
447
+ "spec" : {
448
+ "multiAZ" : True
449
+ },
450
+ }
451
+
452
+ k8s .patch_custom_resource (ref , updates )
453
+ time .sleep (35 )
454
+ condition .assert_not_synced (ref )
455
+ cr = k8s .get_resource (ref )
456
+ assert cr is not None
457
+ assert 'status' in cr
458
+ assert 'spec' in cr
459
+ assert 'multiAZ' in cr ['spec' ]
460
+ assert cr ['spec' ]['multiAZ' ] is True
461
+ assert k8s .wait_on_condition (ref , "ACK.ResourceSynced" , "True" , wait_periods = MAX_WAIT_FOR_SYNCED_MINUTES )
462
+
463
+ latest = db_instance .get (db_instance_id )
464
+ assert latest is not None
465
+ assert latest ['DBInstanceStatus' ] == 'available'
466
+ assert latest ['MultiAZ' ] is True
0 commit comments