Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

eliminate potential silent failures from connection tests

  • Loading branch information...
commit 054c342a1c512a592535ed4389084e88759c13b4 1 parent a7cb4a6
@wg authored
Showing with 9 additions and 4 deletions.
  1. +9 −4 test_src/pgsql_tests.erl
View
13 test_src/pgsql_tests.erl
@@ -10,10 +10,10 @@
-define(port, 5432).
connect_test() ->
- connect_only([[]]).
+ connect_only([]).
connect_to_db_test() ->
- connect_only([[{database, "epgsql_test_db1"}]]).
+ connect_only([{database, "epgsql_test_db1"}]).
connect_as_test() ->
connect_only(["epgsql_test", [{database, "epgsql_test_db1"}]]).
@@ -482,7 +482,13 @@ run_tests() ->
%% -- internal functions --
connect_only(Args) ->
- {ok, C} = apply(pgsql, connect, [?host, [{port, ?port} | Args]]),
+ TestOpts = [{port, ?port}],
+ case Args of
+ [User, Opts] -> Args2 = [User, TestOpts ++ Opts];
+ [User, Pass, Opts] -> Args2 = [User, Pass, TestOpts ++ Opts];
+ Opts -> Args2 = [TestOpts ++ Opts]
+ end,
+ {ok, C} = apply(pgsql, connect, [?host | Args2]),
pgsql:close(C),
flush().
@@ -552,4 +558,3 @@ flush(Acc) ->
after
0 -> lists:reverse(Acc)
end.
-
Please sign in to comment.
Something went wrong with that request. Please try again.