mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-09-30 10:42:14 +02:00
stream: slot and FES should not be created if the publication creation fails (#2704)
* slot should not be created if the publication creation fails * not create FES resource when slot doesn't exist
This commit is contained in:
@@ -2041,6 +2041,20 @@ class EndToEndTestCase(unittest.TestCase):
|
||||
"recoveryEventType": "test-event-dlq"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"applicationId": "test-app2",
|
||||
"batchSize": 100,
|
||||
"database": "foo",
|
||||
"enableRecovery": True,
|
||||
"tables": {
|
||||
"test_non_exist_table": {
|
||||
"eventType": "test-event",
|
||||
"idColumn": "id",
|
||||
"payloadColumn": "payload",
|
||||
"recoveryEventType": "test-event-dlq"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -2064,6 +2078,18 @@ class EndToEndTestCase(unittest.TestCase):
|
||||
"zalando.org", "v1", "default", "fabriceventstreams", label_selector="cluster-name=acid-minimal-cluster")["items"]), 1,
|
||||
"Could not find Fabric Event Stream resource", 10, 5)
|
||||
|
||||
# check if the non-existing table in the stream section does not create a publication and slot
|
||||
get_publication_query_not_exist_table = """
|
||||
SELECT * FROM pg_publication WHERE pubname = 'fes_foo_test_app2';
|
||||
"""
|
||||
get_slot_query_not_exist_table = """
|
||||
SELECT * FROM pg_replication_slots WHERE slot_name = 'fes_foo_test_app2';
|
||||
"""
|
||||
self.eventuallyEqual(lambda: len(self.query_database(leader.metadata.name, "foo", get_publication_query_not_exist_table)), 0,
|
||||
"Publication is created for non-existing tables", 10, 5)
|
||||
self.eventuallyEqual(lambda: len(self.query_database(leader.metadata.name, "foo", get_slot_query_not_exist_table)), 0,
|
||||
"Replication slot is created for non-existing tables", 10, 5)
|
||||
|
||||
# grant create and ownership of test_table to foo_user, reset search path to default
|
||||
grant_permission_foo_user = """
|
||||
GRANT CREATE ON DATABASE foo TO foo_user;
|
||||
|
||||
Reference in New Issue
Block a user