Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit50ad35b

Browse files
authored
Fix test forsocket backend (#219)
The socket backend that `mysql_tests/socket_backend_test` tests is onlysupported in OTP 23+, and still very unstable in 23. Therefore, thechange in this PR skips the test on OTP =< 23.Also changed the level of logs emitted from the test suite from `info`to `notice`, because `info` is below the logging threshold in thedefault configuration, ie the minimum level is `notice`.
1 parent4518b85 commit50ad35b

File tree

2 files changed

+33
-29
lines changed

2 files changed

+33
-29
lines changed

‎test/mysql_tests.erl‎

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -302,16 +302,22 @@ unix_socket_test() ->
302302
mysql:query(Pid2, <<"SELECT 1">>)),
303303
mysql:stop(Pid2);
304304
{error,eafnosupport} ->
305-
logger:info("Skipping unix socket test."
306-
"Not supported on this OS.~n")
305+
logger:notice("Skipping unix socket test."
306+
"Not supported on this OS.~n")
307307
end.
308308

309309
socket_backend_test()->
310-
casemysql:start_link([{user,?user},
311-
{password,?password},
312-
{tcp_options, [{inet_backend,socket}]}])
313-
of
314-
{ok,Pid1} ->
310+
case?OTP_RELEASEof
311+
RelwhenRel<23 ->
312+
logger:notice("Skipping socket backend test."
313+
"Not supported on OTP~b.", [Rel]);
314+
23 ->
315+
logger:notice("Skipping socket backend test."
316+
"Unstable on OTP 23.");
317+
_ ->
318+
{ok,Pid1}=mysql:start_link([{user,?user},
319+
{password,?password},
320+
{tcp_options, [{inet_backend,socket}]}]),
315321
Dir=run_dir(),
316322
{ok, [<<"@@socket">>], [[SockFile0]]}=mysql:query(Pid1, <<"SELECT @@socket">>),
317323
SockFile=filename:join([Dir,filename:basename(SockFile0)]),
@@ -323,11 +329,9 @@ socket_backend_test() ->
323329
?assertEqual({ok, [<<"1">>], [[1]]},mysql:query(Pid2, <<"SELECT 1">>)),
324330
mysql:stop(Pid2);
325331
{error,eafnotsupported} ->
326-
logger:info("Skipping socket backend test."
327-
"Not supported on this OS.~n")
328-
end;
329-
{error,eafnosupport} ->
330-
logger:info("Skipping unix socket test. Not supported on this OS.~n")
332+
logger:notice("Skipping socket backend test."
333+
"Not supported on this OS.~n")
334+
end
331335
end.
332336

333337
connect_queries_failure_test()->
@@ -502,13 +506,13 @@ log_slow_queries_test() ->
502506
?assertEqual("MySQL query #4 was slow:"++MultiQuery++"\n",MultiLog2)
503507
catch
504508
throw:{mysql,version_too_small} ->
505-
logger:info("Skipping Log Slow Queries test. Current MySQL version"
506-
" is~s. Required version is >= 5.5.8.~n",
507-
[VersionStr]);
509+
logger:notice("Skipping Log Slow Queries test. Current MySQL version"
510+
" is~s. Required version is >= 5.5.8.~n",
511+
[VersionStr]);
508512
throw:{mariadb,version_too_small} ->
509-
logger:info("Skipping Log Slow Queries test. Current MariaDB version"
510-
" is~s. Required version is >= 10.0.21.~n",
511-
[VersionStr])
513+
logger:notice("Skipping Log Slow Queries test. Current MariaDB version"
514+
" is~s. Required version is >= 10.0.21.~n",
515+
[VersionStr])
512516
end,
513517
mysql:stop(Pid).
514518

@@ -1018,12 +1022,12 @@ json(Pid) ->
10181022
test_invalid_json(Pid)
10191023
catch
10201024
throw:no_mariadb ->
1021-
logger:info("Skipping JSON test, not supported on"
1022-
" MariaDB.~n");
1025+
logger:notice("Skipping JSON test, not supported on"
1026+
" MariaDB.~n");
10231027
throw:version_too_small ->
1024-
logger:info("Skipping JSON test. Current MySQL version"
1025-
" is~s. Required version is >= 5.7.8.~n",
1026-
[Version])
1028+
logger:notice("Skipping JSON test. Current MySQL version"
1029+
" is~s. Required version is >= 5.7.8.~n",
1030+
[Version])
10271031
end.
10281032

10291033
test_valid_json(Pid)->
@@ -1053,9 +1057,9 @@ microseconds(Pid) ->
10531057
test_time_microseconds(Pid),
10541058
test_datetime_microseconds(Pid)
10551059
catch_:_ ->
1056-
logger:info("Skipping microseconds test. Current MySQL"
1057-
" version is~s. Required version is >= 5.6.4.~n",
1058-
[Version])
1060+
logger:notice("Skipping microseconds test. Current MySQL"
1061+
" version is~s. Required version is >= 5.6.4.~n",
1062+
[Version])
10591063
end.
10601064

10611065
test_time_microseconds(Pid)->

‎test/transaction_tests.erl‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -384,9 +384,9 @@ lock_wait_timeout({_Conn1, Conn2} = Conns) ->
384384
lock_wait_timeout1(Conns);
385385
{error, {1238,_, <<"Variable 'innodb_lock_wait_timeout' is a read on",
386386
_/binary>>}} ->
387-
logger:info("Can't set lock wait timeout in this server"
388-
" version. Skipping the lock wait timeout"
389-
" test.\n")
387+
logger:notice("Can't set lock wait timeout in this server"
388+
" version. Skipping the lock wait timeout"
389+
" test.\n")
390390
end.
391391

392392
%% Continuation of lock_wait_timeout/1.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp