Skip to content

Commit 0aa75e8

Browse files
committed
add e2e slot removal
1 parent 9cae38d commit 0aa75e8

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,
@@ -494,6 +497,34 @@ def compare_config():
494497
self.eventuallyEqual(lambda: self.query_database(replica.metadata.name, "postgres", setting_query)[0], lower_max_connections_value,
495498
"Previous max_connections setting not applied on replica", 10, 5)
496499

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

0 commit comments

Comments
 (0)