|
51 | 51 |
|
52 | 52 | expect(pg_publications(connection_url: connection_url)).to eq([])
|
53 | 53 | end
|
| 54 | + |
| 55 | + it "raises an error when user does not have sufficient privileges" do |
| 56 | + # Use a limited user for this test case |
| 57 | + restricted_user = "no_sup" |
| 58 | + restricted_user_connection_url = connection_url(restricted_user) |
| 59 | + |
| 60 | + described_class.create_publication( |
| 61 | + group_name: "cluster1", |
| 62 | + conn_string: connection_url, |
| 63 | + ) |
| 64 | + |
| 65 | + expect do |
| 66 | + described_class.drop_publication( |
| 67 | + group_name: "cluster1", |
| 68 | + conn_string: restricted_user_connection_url, |
| 69 | + ) |
| 70 | + end.to raise_error(RuntimeError) { |e| |
| 71 | + expect(e.message).to include("Unable to drop publication") |
| 72 | + } |
| 73 | + expect(pg_publications(connection_url: connection_url)).not_to eq([]) |
| 74 | + end |
54 | 75 | end
|
55 | 76 |
|
56 | 77 | describe ".add_tables_to_publication" do
|
|
190 | 211 | describe ".drop_subscription" do
|
191 | 212 | before do
|
192 | 213 | PgEasyReplicate.bootstrap({ group_name: "cluster1" })
|
193 |
| - |
194 |
| - described_class.create_publication( |
195 |
| - group_name: "cluster1", |
196 |
| - conn_string: connection_url, |
197 |
| - ) |
198 | 214 | end
|
199 | 215 |
|
200 | 216 | after do
|
201 |
| - described_class.drop_publication( |
202 |
| - group_name: "cluster1", |
203 |
| - conn_string: connection_url, |
204 |
| - ) |
205 | 217 | PgEasyReplicate.cleanup({ everything: true, group_name: "cluster1" })
|
206 | 218 | end
|
207 | 219 |
|
|
218 | 230 |
|
219 | 231 | expect(pg_subscriptions(connection_url: target_connection_url)).to eq([])
|
220 | 232 | end
|
| 233 | + |
| 234 | + it "raises an error when user does not have sufficient privileges" do |
| 235 | + # Use a limited user for this test case |
| 236 | + restricted_user = "no_sup" |
| 237 | + restricted_user_target_connection_url = target_connection_url(restricted_user) |
| 238 | + |
| 239 | + described_class.create_subscription( |
| 240 | + group_name: "cluster1", |
| 241 | + source_conn_string: docker_compose_source_connection_url, |
| 242 | + target_conn_string: target_connection_url, |
| 243 | + ) |
| 244 | + |
| 245 | + expect do |
| 246 | + described_class.drop_subscription( |
| 247 | + group_name: "cluster1", |
| 248 | + target_conn_string: restricted_user_target_connection_url, |
| 249 | + ) |
| 250 | + end.to raise_error(RuntimeError) { |e| |
| 251 | + expect(e.message).to include("Unable to drop subscription") |
| 252 | + } |
| 253 | + expect(pg_subscriptions(connection_url: target_connection_url)).not_to eq([]) |
| 254 | + end |
221 | 255 | end
|
222 | 256 |
|
223 | 257 | describe ".start_sync" do
|
|
0 commit comments