Skip to content

Commit cea0d61

Browse files
committed
test feature
1 parent bb29a2e commit cea0d61

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

test/e2e/tests/test_db_instance.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,11 @@ def postgres14_t3_micro_instance(k8s_secret):
9494

9595
yield (ref, cr, secret.name)
9696

97-
# Try to delete, if doesn't already exist
98-
try:
99-
_, deleted = k8s.delete_custom_resource(ref, 3, 10)
100-
except:
101-
pass
97+
k8s.delete_custom_resource(ref)
98+
assert k8s.get_resource_exists(ref)
10299
db_instance.wait_until_deleted(db_instance_id)
100+
time.sleep(60)
101+
assert not k8s.get_resource_exists(ref)
103102

104103
@service_marker
105104
@pytest.mark.canary

test/e2e/tests/test_references.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -287,25 +287,24 @@ def test_references(
287287
# we try to delete the DB Parameter Group before the DB Instance, the
288288
# cascading delete protection of resource references will mean the DB
289289
# Parameter Group won't be deleted.
290-
_, deleted = k8s.delete_custom_resource(
291-
db_instance_ref,
292-
period_length=DELETE_INSTANCE_TIMEOUT_SECONDS,
293-
)
294-
assert deleted
290+
k8s.delete_custom_resource(db_instance_ref)
291+
# ensure db_instance does not disappear immidiately from k8s
292+
assert k8s.get_resource_exists(db_instance_ref)
295293

296294
# Wait a bit before trying to delete the cluster since the instance is
297295
# part of the cluster and sometimes the delete cluster complains if
298296
# it's too soon after deleting the last DB instance in it.
297+
db_instance.wait_until_deleted(db_instance_id)
299298
time.sleep(60)
299+
# ensure db_instance is removed from k8s once it is removed from AWS
300+
assert not k8s.get_resource_exists(db_instance_ref)
300301

301-
db_instance.wait_until_deleted(db_instance_id)
302302

303303
# Same for the DB cluster because it refers to the DB cluster
304304
# parameter group...
305-
_, deleted = k8s.delete_custom_resource(
306-
db_cluster_ref,
307-
period_length=DELETE_CLUSTER_TIMEOUT_SECONDS,
308-
)
309-
assert deleted
305+
k8s.delete_custom_resource(db_cluster_ref)
306+
assert k8s.get_resource_exists(db_cluster_ref)
310307

311308
db_cluster.wait_until_deleted(db_cluster_id)
309+
time.sleep(60)
310+
assert not k8s.get_resource_exists(db_cluster_ref)

0 commit comments

Comments
 (0)