File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change 2323
2424from time import sleep
2525from e2e import service_marker , CRD_GROUP , CRD_VERSION , load_elasticache_resource
26+ from e2e .util import assert_user_deletion
2627
2728RESOURCE_PLURAL = "users"
28- DEFAULT_WAIT_SECS = 90
29+ DEFAULT_WAIT_SECS = 30
2930
3031
3132@pytest .fixture (scope = "module" )
@@ -57,8 +58,7 @@ def user_nopass(user_nopass_input, elasticache_client):
5758 # teardown: delete in k8s, assert user does not exist in AWS
5859 k8s .delete_custom_resource (reference )
5960 sleep (DEFAULT_WAIT_SECS )
60- with pytest .raises (botocore .exceptions .ClientError , match = "UserNotFound" ):
61- _ = elasticache_client .describe_users (UserId = user_nopass_input ["USER_ID" ])
61+ assert_user_deletion (user_nopass_input ['USER_ID' ])
6262
6363
6464# create secrets for below user password test
@@ -104,8 +104,7 @@ def user_password(user_password_input, elasticache_client):
104104 # teardown: delete in k8s, assert user does not exist in AWS
105105 k8s .delete_custom_resource (reference )
106106 sleep (DEFAULT_WAIT_SECS )
107- with pytest .raises (botocore .exceptions .ClientError , match = "UserNotFound" ):
108- _ = elasticache_client .describe_users (UserId = user_password_input ["USER_ID" ])
107+ assert_user_deletion (user_password_input ['USER_ID' ])
109108
110109
111110@service_marker
Original file line number Diff line number Diff line change @@ -81,6 +81,17 @@ def wait_snapshot_deleted(snapshot_name: str,
8181 return False
8282
8383
84+ # assert that either: 1) deletion has been initiated, or 2) deletion has been completed
85+ # on the service-side
86+ def assert_user_deletion (user_id : str ):
87+ try :
88+ resp = ec .describe_users (UserId = user_id )
89+ assert len (resp ['Users' ]) == 1
90+ assert resp ['Users' ][0 ]['Status' ] == 'deleting' # at this point, deletion is a server-side responsibility
91+ except ec .exceptions .UserNotFoundFault :
92+ pass # we only expect this particular exception (if deletion has already completed)
93+
94+
8495# provide a basic nodeGroupConfiguration object of desired size
8596def provide_node_group_configuration (size : int ):
8697 ngc = []
You can’t perform that action at this time.
0 commit comments