Browse Source

Add test which tries to start replication on an undefined slot

Yury Yantsevich 2 years ago
parent
commit
db2f46450b
1 changed files with 13 additions and 0 deletions
  1. 13 0
      test/epgsql_replication_SUITE.erl

+ 13 - 0
test/epgsql_replication_SUITE.erl

@@ -10,6 +10,7 @@
 
          connect_in_repl_mode/1,
          create_drop_replication_slot/1,
+         no_replication_slot/1,
          replication_sync/1,
          replication_async/1,
          replication_async_active_n_socket/1,
@@ -30,6 +31,7 @@ end_per_suite(_Config) ->
 all() ->
   [connect_in_repl_mode,
    create_drop_replication_slot,
+   no_replication_slot,
    replication_async,
    replication_sync,
    replication_async_active_n_socket,
@@ -116,6 +118,17 @@ two_replications_on_same_slot(Config) ->
     [{replication, "database"}]),
   drop_replication_slot(Config).
 
+no_replication_slot(Config) ->
+  Module = ?config(module, Config),
+  epgsql_ct:with_connection(
+    Config,
+    fun(C) ->
+        Res = Module:start_replication(C, "epgsql_test", self(), {C, self()}, "0/0"),
+        ?assertMatch({error, #error{codename = undefined_object}}, Res)
+    end,
+    "epgsql_test_replication",
+    [{replication, "database"}]).
+
 replication_test_run(Config, Callback) ->
   replication_test_run(Config, Callback, []).