@@ -1860,13 +1860,7 @@ def test_password_rotation(self):
1860
1860
self .eventuallyEqual (lambda : len (self .query_database_with_user (leader .metadata .name , "postgres" , "SELECT 1" , "foo_user" )), 1 ,
1861
1861
"Could not connect to the database with rotation user {}" .format (rotation_user ), 10 , 5 )
1862
1862
1863
- # check if rotation has been ignored for user from test_cross_namespace_secrets test
1864
- db_user_secret = k8s .get_secret (username = "test.db_user" , namespace = "test" )
1865
- secret_username = str (base64 .b64decode (db_user_secret .data ["username" ]), 'utf-8' )
1866
- self .assertEqual ("test.db_user" , secret_username ,
1867
- "Unexpected username in secret of test.db_user: expected {}, got {}" .format ("test.db_user" , secret_username ))
1868
-
1869
- # do a cluster update which syncs secrets but not not init users
1863
+ # add annotation which triggers syncSecrets call
1870
1864
pg_annotation_patch = {
1871
1865
"metadata" : {
1872
1866
"annotations" : {
@@ -1877,10 +1871,18 @@ def test_password_rotation(self):
1877
1871
k8s .api .custom_objects_api .patch_namespaced_custom_object (
1878
1872
"acid.zalan.do" , "v1" , "default" , "postgresqls" , "acid-minimal-cluster" , pg_annotation_patch )
1879
1873
self .eventuallyEqual (lambda : k8s .get_operator_state (), {"0" : "idle" }, "Operator does not get in sync" )
1880
-
1881
1874
time .sleep (10 )
1882
1875
self .eventuallyEqual (lambda : k8s .count_secrets_with_label (cluster_label ), secret_count , "Unexpected number of secrets" )
1883
1876
1877
+ # check if rotation has been ignored for user from test_cross_namespace_secrets test
1878
+ db_user_secret = k8s .get_secret (username = "test.db_user" , namespace = "test" )
1879
+ secret_username = str (base64 .b64decode (db_user_secret .data ["username" ]), 'utf-8' )
1880
+ self .assertEqual ("test.db_user" , secret_username ,
1881
+ "Unexpected username in secret of test.db_user: expected {}, got {}" .format ("test.db_user" , secret_username ))
1882
+
1883
+ # check if annotation for secret has been updated
1884
+ self .assertTrue ("deployment-time" in db_user_secret .metadata .annotations , "Added annotation was not propagated to secret" )
1885
+
1884
1886
# disable password rotation for all other users (foo_user)
1885
1887
# and pick smaller intervals to see if the third fake rotation user is dropped
1886
1888
enable_password_rotation = {
0 commit comments