Skip to content

Commit 29d09d9

Browse files
committed
add e2e slot removal
1 parent 7370258 commit 29d09d9

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

e2e/tests/test_e2e.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,9 @@ def test_config_update(self):
402402
"slots": {
403403
"test_slot": {
404404
"type": "physical"
405+
},
406+
"test_slot_2": {
407+
"type": "physical"
405408
}
406409
},
407410
"ttl": 29,
@@ -497,6 +500,34 @@ def compare_config():
497500
self.eventuallyEqual(lambda: self.query_database(replica.metadata.name, "postgres", setting_query)[0], lower_max_connections_value,
498501
"Previous max_connections setting not applied on replica", 10, 5)
499502

503+
# delete test_slot_2 from config
504+
slot_to_remove = "test_slot_2"
505+
pg_patch_slots = {
506+
"spec": {
507+
"patroni": {
508+
"slots": {
509+
"test_slot": {
510+
"type": "physical"
511+
}
512+
}
513+
}
514+
}
515+
}
516+
517+
k8s.api.custom_objects_api.patch_namespaced_custom_object(
518+
"acid.zalan.do", "v1", "default", "postgresqls", "acid-minimal-cluster", pg_patch_slots)
519+
520+
self.eventuallyEqual(lambda: k8s.get_operator_state(), {"0": "idle"}, "Operator does not get in sync")
521+
522+
deleted_slot_query = """
523+
SELECT count(*)
524+
FROM pg_replication_slots
525+
WHERE slot_name = '%s';
526+
""" % (slot_to_remove)
527+
528+
self.eventuallyEqual(lambda: self.query_database(replica.metadata.name, "postgres", deleted_slot_query)[0], 0,
529+
"The replication slot cannot be deleted")
530+
500531
except timeout_decorator.TimeoutError:
501532
print('Operator log: {}'.format(k8s.get_operator_log()))
502533
raise

0 commit comments

Comments
 (0)