-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update dependencies with warnings (#723)
- Loading branch information
Showing
4 changed files
with
27 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,36 @@ | ||
defmodule PostgrexTest do | ||
use ExUnit.Case, async: false | ||
import ExUnit.CaptureLog | ||
import ExUnit.CaptureLog, warn: false | ||
|
||
test "start_link/2 sets search path" do | ||
# valid argument | ||
search_path = ["public", "extension"] | ||
{:ok, conn} = Postgrex.start_link(database: "postgrex_test", search_path: search_path) | ||
%{rows: [[result]]} = Postgrex.query!(conn, "show search_path", []) | ||
|
||
assert result == Enum.join(search_path, ", ") | ||
end | ||
|
||
# invalid argument | ||
Process.flag(:trap_exit, true) | ||
search_path = "public, extension" | ||
# gen_statem reports are only captured on Elixir v1.17+ | ||
# but a bug causes the Logger to crash on v1.17.0 and v1.17.1. | ||
if Version.match?(System.version(), ">= 1.17.2") do | ||
test "start_link/2 detects invalid search path" do | ||
# invalid argument | ||
Process.flag(:trap_exit, true) | ||
search_path = "public, extension" | ||
|
||
opts = [ | ||
database: "postgrex_test", | ||
search_path: search_path, | ||
show_sensitive_data_on_connection_error: true | ||
] | ||
opts = [ | ||
database: "postgrex_test", | ||
search_path: search_path, | ||
show_sensitive_data_on_connection_error: true | ||
] | ||
|
||
error_log = | ||
capture_log(fn -> | ||
Postgrex.start_link(opts) | ||
assert_receive {:EXIT, _, :killed} | ||
end) | ||
error_log = | ||
capture_log(fn -> | ||
Postgrex.start_link(opts) | ||
assert_receive {:EXIT, _, :killed} | ||
end) | ||
|
||
assert error_log =~ "expected :search_path to be a list of strings, got: \"#{search_path}\"" | ||
assert error_log =~ "expected :search_path to be a list of strings, got: \"#{search_path}\"" | ||
end | ||
end | ||
end |