Skip to content

Commit cdbc0f3

Browse files
author
Iago Cavalcante
committed
adding tests for :inet6 socket options
1 parent 7a5df58 commit cdbc0f3

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/myxql/client.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ defmodule MyXQL.Client do
4747
ssl_opts: Keyword.get(opts, :ssl_opts, []),
4848
connect_timeout: Keyword.get(opts, :connect_timeout, @default_timeout),
4949
handshake_timeout: Keyword.get(opts, :handshake_timeout, @default_timeout),
50-
socket_options: @sock_opts ++ (opts[:socket_options] || []),
50+
socket_options: (opts[:socket_options] || []) ++ @sock_opts,
5151
charset: Keyword.get(opts, :charset),
5252
collation: Keyword.get(opts, :collation),
5353
enable_cleartext_plugin: Keyword.get(opts, :enable_cleartext_plugin, false)

test/myxql_test.exs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,14 @@ defmodule MyXQLTest do
7070
MyXQL.prepare_execute!(conn, "", "SELECT 1, 2, NOW()")
7171
end
7272

73+
test "custom socket options with :inet6" do
74+
opts = [socket_options: [:inet6]] ++ @opts
75+
{:ok, conn} = MyXQL.start_link(opts)
76+
77+
MyXQL.query!(conn, "SELECT 1, 2, NOW()")
78+
MyXQL.prepare_execute!(conn, "", "SELECT 1, 2, NOW()")
79+
end
80+
7381
test "after_connect callback" do
7482
pid = self()
7583
opts = [after_connect: fn conn -> send(pid, {:connected, conn}) end] ++ @opts

0 commit comments

Comments
 (0)