Skip to content

Commit

Permalink
fixing sporadically failed logint test case
Browse files Browse the repository at this point in the history
  • Loading branch information
mjaric committed Feb 21, 2021
1 parent 571f2b1 commit c8d9070
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions config/test.exs
Expand Up @@ -12,4 +12,5 @@ config :tds,
database: "test",
trace: false,
set_allow_snapshot_isolation: :on
# show_sensitive_data_on_connection_error: true
]
7 changes: 5 additions & 2 deletions test/login_test.exs
Expand Up @@ -36,16 +36,19 @@ defmodule LoginTest do
end

@tag :login
@tag :tls
test "login with valid sql login over tsl", context do
opts =
Application.fetch_env!(:tds, :opts) ++
[ssl: true, ssl_opts: [log_debug: true]]
[ssl: true, ssl_opts: []]
# [ssl: true, ssl_opts: [log_debug: true, log_level: :debug]]

assert {:ok, pid} = Tds.start_link(opts ++ context[:options])
assert {:ok, %Tds.Result{}} = Tds.query(pid, "SELECT 1", [])
end

@tag :login
@tag :tls
test "login with non existing sql server authentication over tls", context do
assert capture_log(fn ->
opts =
Expand All @@ -62,7 +65,7 @@ defmodule LoginTest do
Process.flag(:trap_exit, true)

case Tds.start_link(opts) do
{:ok, pid} -> assert_receive {:EXIT, ^pid, :killed}
{:ok, pid} -> assert_receive {:EXIT, ^pid, :killed}, 1_000
{:error, :killed} -> :ok
end
end
Expand Down

0 comments on commit c8d9070

Please sign in to comment.