Skip to content

Commit c242bb0

Browse files
authored
Added CI tests for MySQL 9.x
close #303
1 parent d66156a commit c242bb0

File tree

8 files changed

+43
-19
lines changed

8 files changed

+43
-19
lines changed

.drone.star

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ def main(ctx):
318318
linux_b2('Linux B2 clang-10', _image('build-clang10:2'), toolset='clang-10', cxxstd='17,20', variant='debug'),
319319
linux_b2('Linux B2 clang-11', _image('build-clang11:2'), toolset='clang-11', cxxstd='20'),
320320
linux_b2('Linux B2 clang-12', _image('build-clang12:2'), toolset='clang-12', cxxstd='20', variant='debug', stdlib='libc++', address_sanitizer=1, undefined_sanitizer=1),
321-
linux_b2('Linux B2 clang-13', _image('build-clang13:1'), toolset='clang-13', cxxstd='20'),
321+
linux_b2('Linux B2 clang-13', _image('build-clang13:1'), toolset='clang-13', cxxstd='20', db='mysql-9_4_0:1'),
322322
linux_b2('Linux B2 clang-14', _image('build-clang14:1'), toolset='clang-14', cxxstd='20', variant='debug'),
323323
linux_b2('Linux B2 clang-15', _image('build-clang15:1'), toolset='clang-15', cxxstd='20', variant='debug'),
324324
linux_b2('Linux B2 clang-16', _image('build-clang16:1'), toolset='clang-16', cxxstd='20', variant='debug', address_sanitizer=1, undefined_sanitizer=1),
@@ -338,7 +338,7 @@ def main(ctx):
338338
linux_b2('Linux B2 gcc-10', _image('build-gcc10:1'), toolset='gcc-10', cxxstd='17'),
339339
linux_b2('Linux B2 gcc-11', _image('build-gcc11:1'), toolset='gcc-11', cxxstd='20'),
340340
linux_b2('Linux B2 gcc-12', _image('build-gcc12:1'), toolset='gcc-12', cxxstd='20,23', variant='debug'),
341-
linux_b2('Linux B2 gcc-13', _image('build-gcc13:1'), toolset='gcc-13', cxxstd='20'),
341+
linux_b2('Linux B2 gcc-13', _image('build-gcc13:1'), toolset='gcc-13', cxxstd='20', db='mysql-9_4_0:1'),
342342
linux_b2('Linux B2 gcc-14', _image('build-gcc14:1'), toolset='gcc-14', cxxstd='23'),
343343
linux_b2('Linux B2 gcc-15', _image('build-gcc15:1'), toolset='gcc-15', cxxstd='23'),
344344
linux_b2('Linux B2 gcc-sanit', _image('build-gcc14:1'), toolset='gcc-14', cxxstd='23', variant='debug', address_sanitizer=1, undefined_sanitizer=1),

example/db_setup.sql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ DELIMITER ;
8282

8383
-- User
8484
DROP USER IF EXISTS 'example_user'@'%';
85-
CREATE USER 'example_user'@'%' IDENTIFIED WITH 'mysql_native_password';
86-
ALTER USER 'example_user'@'%' IDENTIFIED BY 'example_password';
85+
CREATE USER 'example_user'@'%' IDENTIFIED BY 'example_password';
8786
GRANT ALL PRIVILEGES ON boost_mysql_examples.* TO 'example_user'@'%';
8887
FLUSH PRIVILEGES;

test/integration/db_setup.sql

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -492,20 +492,9 @@ INSERT INTO types_flags VALUES
492492

493493
-- Users
494494
DROP USER IF EXISTS 'integ_user'@'%';
495-
CREATE USER 'integ_user'@'%' IDENTIFIED WITH 'mysql_native_password';
496-
ALTER USER 'integ_user'@'%' IDENTIFIED BY 'integ_password';
495+
CREATE USER 'integ_user'@'%' IDENTIFIED BY 'integ_password';
497496
GRANT ALL PRIVILEGES ON boost_mysql_integtests.* TO 'integ_user'@'%';
498497

499-
DROP USER IF EXISTS 'mysqlnp_user'@'%';
500-
CREATE USER 'mysqlnp_user'@'%' IDENTIFIED WITH 'mysql_native_password';
501-
ALTER USER 'mysqlnp_user'@'%' IDENTIFIED BY 'mysqlnp_password';
502-
GRANT ALL PRIVILEGES ON boost_mysql_integtests.* TO 'mysqlnp_user'@'%';
503-
504-
DROP USER IF EXISTS 'mysqlnp_empty_password_user'@'%';
505-
CREATE USER 'mysqlnp_empty_password_user'@'%' IDENTIFIED WITH 'mysql_native_password';
506-
ALTER USER 'mysqlnp_empty_password_user'@'%' IDENTIFIED BY '';
507-
GRANT ALL PRIVILEGES ON boost_mysql_integtests.* TO 'mysqlnp_empty_password_user'@'%';
508-
509498
-- Some containers don't allow remote root access. Enable it.
510499
CREATE USER IF NOT EXISTS 'root'@'%' IDENTIFIED BY '';
511500
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;

test/integration/db_setup_mnp.sql

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--
2+
-- Copyright (c) 2019-2025 Ruben Perez Hidalgo (rubenperez038 at gmail dot com)
3+
--
4+
-- Distributed under the Boost Software License, Version 1.0. (See accompanying
5+
-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6+
--
7+
8+
USE boost_mysql_integtests;
9+
10+
-- Setup that requires the presence of the mysql_native_password functionality
11+
DROP USER IF EXISTS 'mysqlnp_user'@'%';
12+
CREATE USER 'mysqlnp_user'@'%' IDENTIFIED WITH 'mysql_native_password';
13+
ALTER USER 'mysqlnp_user'@'%' IDENTIFIED BY 'mysqlnp_password';
14+
GRANT ALL PRIVILEGES ON boost_mysql_integtests.* TO 'mysqlnp_user'@'%';
15+
16+
DROP USER IF EXISTS 'mysqlnp_empty_password_user'@'%';
17+
CREATE USER 'mysqlnp_empty_password_user'@'%' IDENTIFIED WITH 'mysql_native_password';
18+
ALTER USER 'mysqlnp_empty_password_user'@'%' IDENTIFIED BY '';
19+
GRANT ALL PRIVILEGES ON boost_mysql_integtests.* TO 'mysqlnp_empty_password_user'@'%';
20+
21+
FLUSH PRIVILEGES;

test/integration/include/test_integration/server_features.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ struct server_features
2525
// Includes caching_sha2_password and sha256_password
2626
bool sha256{true};
2727

28+
// Does the server support the mysql_native_password authentication method?
29+
bool mnp{true};
30+
2831
// Does the server support the dedicated JSON type?
2932
bool json_type{true};
3033

test/integration/src/server_features.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ static test::server_features do_get_server_features()
5656
{"json-type", &test::server_features::json_type },
5757
{"regex-error-codes", &test::server_features::regex_error_codes },
5858
{"dup-query-error-codes", &test::server_features::dup_query_error_codes},
59+
{"mnp", &test::server_features::mnp },
5960
};
6061

6162
// Match disabled features against the possible set

test/integration/test/handshake.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ void check_ssl(Conn& conn, bool expected, boost::source_location loc = BOOST_MYS
102102
}
103103

104104
// mysql_native_password
105+
BOOST_TEST_DECORATOR(*run_if(&server_features::mnp))
105106
BOOST_AUTO_TEST_SUITE(mysql_native_password)
106107

107108
constexpr const char* regular_user = "mysqlnp_user";

tools/ci/ci_util/db_setup.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
class _DbSystemType(Enum):
1919
mysql5 = 1
2020
mysql8 = 2
21-
mariadb = 3
21+
mysql9 = 3
22+
mariadb = 4
2223

2324

2425
def _run_piped_stdin(args: List[str], fname: Path) -> None:
@@ -54,8 +55,12 @@ def _parse_db_version(db: str) -> _DbSystemType:
5455
# Perform the matching
5556
if is_mariadb:
5657
return _DbSystemType.mariadb
58+
elif vmaj == 8:
59+
return _DbSystemType.mysql8
60+
elif vmaj >= 9:
61+
return _DbSystemType.mysql9
5762
else:
58-
return _DbSystemType.mysql8 if vmaj >= 8 else _DbSystemType.mysql5
63+
return _DbSystemType.mysql5
5964

6065

6166
def _compute_disabled_features(db: _DbSystemType) -> Dict[str, bool]:
@@ -73,7 +78,10 @@ def _compute_disabled_features(db: _DbSystemType) -> Dict[str, bool]:
7378
'regex-error-codes': db in (_DbSystemType.mysql5, _DbSystemType.mariadb),
7479

7580
# dup-query-error-codes. Disabled in mysql systems
76-
'dup-query-error-codes': db in (_DbSystemType.mysql5, _DbSystemType.mysql8),
81+
'dup-query-error-codes': db in (_DbSystemType.mysql5, _DbSystemType.mysql8, _DbSystemType.mysql9),
82+
83+
# mysql_native_password. Disabled in mysql9
84+
'mnp': db == _DbSystemType.mysql9,
7785
}
7886

7987

@@ -96,6 +104,8 @@ def db_setup(
96104
_run_sql_file(source_dir.joinpath('test', 'integration', 'db_setup.sql'))
97105
if not disabled_features['sha256']:
98106
_run_sql_file(source_dir.joinpath('test', 'integration', 'db_setup_sha256.sql'))
107+
if not disabled_features['mnp']:
108+
_run_sql_file(source_dir.joinpath('test', 'integration', 'db_setup_mnp.sql'))
99109

100110
# Setup environment variables
101111
os.environ['BOOST_MYSQL_SERVER_HOST'] = server_host

0 commit comments

Comments
 (0)