Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmach committed Feb 13, 2024
1 parent deb741e commit 10f505a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 38 deletions.
63 changes: 31 additions & 32 deletions test/myxql/client_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -469,38 +469,37 @@ defmodule MyXQL.ClientTest do
start_fake_server(fn %{accept_socket: sock} ->
# The initial handshake which the mysql server always sends. Usually, like in this
# case, it contains scramble data with `mysql_native_password`.
initial_handshake =
[
# packet size
<<74, 0, 0>>,
# packet sequence
0,
# protocol version, always 0x10
10,
# mysql version
["8.0.35", 0],
# thread id
<<127, 24, 4, 0>>,
# auth_plugin_data_1
<<93, 42, 61, 27, 60, 38, 85, 12>>,
# filler
0,
# capability flags 1
<<255, 255>>,
# charset
<<255>>,
# status flags
<<2, 0>>,
# capability flags 2
<<255, 223>>,
# auth_plugin_data_len
21,
# reserved
<<0, 0, 0, 0, 0, 0, 0, 0, 0, 0>>,
<<39, 48, 10, 117, 54, 65, 74, 37, 125, 121, 93, 6, 0>>,
# auth_plugin_name
["mysql_native_password", 0]
]
initial_handshake = [
# packet size
<<74, 0, 0>>,
# packet sequence
0,
# protocol version, always 0x10
10,
# mysql version
["8.0.35", 0],
# thread id
<<127, 24, 4, 0>>,
# auth_plugin_data_1
<<93, 42, 61, 27, 60, 38, 85, 12>>,
# filler
0,
# capability flags 1
<<255, 255>>,
# charset
<<255>>,
# status flags
<<2, 0>>,
# capability flags 2
<<255, 223>>,
# auth_plugin_data_len
21,
# reserved
<<0, 0, 0, 0, 0, 0, 0, 0, 0, 0>>,
<<39, 48, 10, 117, 54, 65, 74, 37, 125, 121, 93, 6, 0>>,
# auth_plugin_name
["mysql_native_password", 0]
]

# Client will use the scramble to attempt authentication with `mysql_native_password`
# (or whichever default auth plugin is used). This will fail, but must be done before
Expand Down
8 changes: 2 additions & 6 deletions test/myxql_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,7 @@ defmodule MyXQLTest do

test "#{@protocol}: query with multiple rows", c do
%MyXQL.Result{num_rows: 2} =
MyXQL.query!(c.conn, "INSERT INTO integers VALUES (10), (20)", [],
query_type: @protocol
)
MyXQL.query!(c.conn, "INSERT INTO integers VALUES (10), (20)", [], query_type: @protocol)

assert {:ok, %MyXQL.Result{columns: ["x"], rows: [[10], [20]]}} =
MyXQL.query(c.conn, "SELECT * FROM integers")
Expand All @@ -170,9 +168,7 @@ defmodule MyXQLTest do
values = Enum.map_join(1..num, ", ", &"(#{&1})")

result =
MyXQL.query!(c.conn, "INSERT INTO integers VALUES " <> values, [],
query_type: @protocol
)
MyXQL.query!(c.conn, "INSERT INTO integers VALUES " <> values, [], query_type: @protocol)

assert result.num_rows == num

Expand Down

0 comments on commit 10f505a

Please sign in to comment.