Merge branch '2.2' into develop
This commit is contained in:
commit
7e9062f20f
@ -363,6 +363,7 @@ extern void server_clear_status_nolock(SERVER *server, uint64_t bit);
|
||||
extern void server_transfer_status(SERVER *dest_server, const SERVER *source_server);
|
||||
extern void server_add_mon_user(SERVER *server, const char *user, const char *passwd);
|
||||
extern size_t server_get_parameter(const SERVER *server, const char *name, char* out, size_t size);
|
||||
extern size_t server_get_parameter_nolock(const SERVER *server, const char *name, char* out, size_t size);
|
||||
extern void server_update_credentials(SERVER *server, const char *user, const char *passwd);
|
||||
extern DCB* server_get_persistent(SERVER *server, const char *user, const char* ip, const char *protocol, int id);
|
||||
extern void server_update_address(SERVER *server, const char *address);
|
||||
|
248
maxscale-system-test/.gitignore
vendored
248
maxscale-system-test/.gitignore
vendored
@ -1,248 +0,0 @@
|
||||
*.pem
|
||||
jansson
|
||||
jansson-prefix
|
||||
LOGS
|
||||
mdbci/*network_config_export
|
||||
mdbci/repo.d
|
||||
mdbci/team_keys
|
||||
|
||||
CMakeCache.txt
|
||||
CTestTestfile.cmake
|
||||
DartConfiguration.tcl
|
||||
avro
|
||||
avro_alter
|
||||
avro_long
|
||||
backend_auth_fail
|
||||
bin/
|
||||
binary_ps
|
||||
binary_ps_cursor
|
||||
binlog_big_transaction
|
||||
binlog_change_master
|
||||
binlog_change_master_gtid
|
||||
binlog_incompl
|
||||
binlog_semisync
|
||||
bug143
|
||||
bug422
|
||||
bug448
|
||||
bug469
|
||||
bug471
|
||||
bug473
|
||||
bug475
|
||||
bug488
|
||||
bug507
|
||||
bug509
|
||||
bug519
|
||||
bug529
|
||||
bug547
|
||||
bug565
|
||||
bug571
|
||||
bug572
|
||||
bug587
|
||||
bug592
|
||||
bug601
|
||||
bug620
|
||||
bug626
|
||||
bug634
|
||||
bug643
|
||||
bug645
|
||||
bug645_1
|
||||
bug649
|
||||
bug650
|
||||
bug653
|
||||
bug654
|
||||
bug657
|
||||
bug658
|
||||
bug662
|
||||
bug664
|
||||
bug670
|
||||
bug673
|
||||
bug676
|
||||
bug681
|
||||
bug694
|
||||
bug699
|
||||
bug705
|
||||
bug711
|
||||
bug729
|
||||
bug730
|
||||
bulk_insert
|
||||
cache_runtime
|
||||
cache_runtime_ttl
|
||||
ccrfilter
|
||||
cdc_client
|
||||
cdc_connector-prefix/
|
||||
cdc_connector/include/
|
||||
cdc_datatypes/CTestTestfile.cmake
|
||||
cdc_datatypes/cdc_datatypes
|
||||
cdc_datatypes/cmake_install.cmake
|
||||
cdc_datatypes/templates
|
||||
change_master_during_session
|
||||
change_user
|
||||
check_backend
|
||||
cmake_install.cmake
|
||||
compound_statement
|
||||
config_test
|
||||
connect_to_nonexisting_db
|
||||
connection_limit
|
||||
connector-c-prefix/
|
||||
crash_out_of_files
|
||||
crash_out_of_files_galera
|
||||
create_rds
|
||||
delete_rds
|
||||
different_size_binlog
|
||||
different_size_rwsplit
|
||||
encrypted_passwords
|
||||
failover_mysqlmon
|
||||
false_monitor_state_change
|
||||
fwf
|
||||
fwf2
|
||||
fwf_MXS-1583
|
||||
fwf_actions
|
||||
fwf_com_ping
|
||||
fwf_duplicate_rules
|
||||
fwf_logging
|
||||
fwf_prepared_stmt
|
||||
fwf_reload
|
||||
fwf_syntax
|
||||
fwf_users
|
||||
galera_priority
|
||||
include/
|
||||
keepalived
|
||||
kerberos_setup
|
||||
kill_master
|
||||
large_insert_hang
|
||||
load_balancing
|
||||
load_balancing_galera
|
||||
local_address
|
||||
long_sysbench
|
||||
longblob
|
||||
lots_of_rows
|
||||
maxctrl_basic
|
||||
max_connections
|
||||
maxscale_process_user
|
||||
mm
|
||||
mm_mysqlmon
|
||||
mysqlmon_detect_standalone_master
|
||||
mysqlmon_failover_no_slaves
|
||||
mysqlmon_failover_manual
|
||||
mysqlmon_failover_manual2_4
|
||||
mysqlmon_failover_manual2_3
|
||||
mysqlmon_failover_manual2_2
|
||||
mysqlmon_failover_rejoin_old_slave
|
||||
mysqlmon_failover_rolling_master
|
||||
mysqlmon_failover_rolling_restart_slaves
|
||||
mysqlmon_failover_stress
|
||||
mysqlmon_switchover
|
||||
mysqlmon_switchover_bad_master
|
||||
mysqlmon_switchover_stress
|
||||
mxs1045
|
||||
mxs1071_maxrows
|
||||
mxs1110_16mb
|
||||
mxs1123
|
||||
mxs118
|
||||
mxs127
|
||||
mxs1295_sp_call
|
||||
mxs1310_implicit_db
|
||||
mxs1319
|
||||
mxs1323_retry_read
|
||||
mxs1323_stress
|
||||
mxs1418
|
||||
mxs1451_skip_auth
|
||||
mxs1457_ignore_deleted
|
||||
mxs1468
|
||||
mxs1476
|
||||
mxs1509
|
||||
mxs1516
|
||||
mxs1542
|
||||
mxs1543
|
||||
mxs1583_fwf
|
||||
mxs1585
|
||||
mxs1643_extra_events
|
||||
mxs1653_ps_hang
|
||||
mxs1677_temp_table
|
||||
mxs1678_relay_master
|
||||
mxs1719
|
||||
mxs244_prepared_stmt_loop
|
||||
mxs280_select_outfile
|
||||
mxs314
|
||||
mxs321
|
||||
mxs365
|
||||
mxs37_table_privilege
|
||||
mxs431
|
||||
mxs47
|
||||
mxs501_tee_usedb
|
||||
mxs548_short_session_change_user
|
||||
mxs559_block_master
|
||||
mxs564_big_dump
|
||||
mxs621_unreadable_cnf
|
||||
mxs657_restart
|
||||
mxs657_restart_service
|
||||
mxs682_cyrillic
|
||||
mxs716
|
||||
mxs722
|
||||
mxs729_maxadmin
|
||||
mxs781_binlog_wrong_passwrd
|
||||
mxs812_1
|
||||
mxs812_2
|
||||
mxs813_long_hostname
|
||||
mxs822_maxpasswd
|
||||
mxs827_write_timeout
|
||||
mxs874_slave_recovery
|
||||
mxs922_bad_server
|
||||
mxs922_double_listener
|
||||
mxs922_listener_ssl
|
||||
mxs922_monitor
|
||||
mxs922_restart
|
||||
mxs922_scaling
|
||||
mxs922_server
|
||||
mxs951_utfmb4
|
||||
mxs957
|
||||
mysqlmon_external_master
|
||||
mysqlmon_failover_auto
|
||||
mysqlmon_failover_manual
|
||||
mysqlmon_rejoin_good
|
||||
mysqlmon_rejoin_bad
|
||||
mysqlmon_rejoin_bad2
|
||||
mysqlmon_rejoin_manual
|
||||
mysqlmon_rejoin_manual2
|
||||
namedserverfilter
|
||||
no_password
|
||||
non_native_setup
|
||||
open_close_connections
|
||||
pers_01
|
||||
pers_02
|
||||
prepared_statement
|
||||
readconnrouter_master
|
||||
readconnrouter_slave
|
||||
regexfilter1
|
||||
replication_manager
|
||||
rw_select_insert
|
||||
rwsplit_conn_num
|
||||
rwsplit_connect
|
||||
rwsplit_multi_stmt
|
||||
rwsplit_read_only_trx
|
||||
rwsplit_readonly
|
||||
rwsplit_readonly_stress
|
||||
schemarouter_duplicate_db
|
||||
script
|
||||
sequence
|
||||
server_weight
|
||||
ses_bigmem
|
||||
session_limits
|
||||
setup_binlog
|
||||
setup_binlog_gtid
|
||||
sharding
|
||||
sharding_load_data
|
||||
short_sessions
|
||||
show_monitor_crash
|
||||
slave_failover
|
||||
sql_queries
|
||||
stale_slaves
|
||||
sysbench_example
|
||||
sysbench_kill_slave
|
||||
t
|
||||
templates
|
||||
templates.h
|
||||
temporal_tables
|
||||
test_hints
|
||||
test_maxctrl
|
||||
verify_master_failure
|
@ -14,7 +14,6 @@
|
||||
|
||||
project(maxscale_system_test)
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
include_directories("/usr/include/mysql/")
|
||||
set(CTEST_BUILD_NAME "${BUILDNAME}")
|
||||
|
||||
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of
|
||||
@ -31,21 +30,8 @@ enable_testing()
|
||||
# utilities.cmake contains all helper functions and extra tools
|
||||
include(utilities.cmake)
|
||||
|
||||
# Is this needed?
|
||||
configure_file(${CMAKE_SOURCE_DIR}/cnf/maxscale.cnf.template.setup_binlog.in ${CMAKE_BINARY_DIR}/cnf/maxscale.cnf.template.setup_binlog @ONLY)
|
||||
|
||||
# Enable Java
|
||||
find_package(Java)
|
||||
if(EXISTS ${Java_JAVA_EXECUTABLE} ${JAVA_JAVAC_EXECUTABLE} ${JAVA_JAR_EXECUTABLE})
|
||||
include(UseJava)
|
||||
if(Java_FOUND)
|
||||
add_subdirectory(maxscale/java/)
|
||||
endif()
|
||||
else()
|
||||
message(WARNING "Java not found, Java based tests are not run.")
|
||||
endif()
|
||||
|
||||
# The core library
|
||||
include_directories(${CMAKE_BINARY_DIR})
|
||||
add_library(testcore SHARED testconnections.cpp nodes.cpp mariadb_nodes.cpp maxscales.cpp
|
||||
mariadb_func.cpp get_com_select_insert.cpp maxadmin_operations.cpp big_transaction.cpp
|
||||
sql_t1.cpp test_binlog_fnc.cpp get_my_ip.cpp big_load.cpp get_com_select_insert.cpp
|
||||
@ -151,9 +137,9 @@ add_test_executable(bug572.cpp bug572 replication LABELS readwritesplit REPL_BAC
|
||||
|
||||
# Regression cases for the bug "Hint filter don't work if listed before regex filter in configuration file"
|
||||
# (different filter sequence and configuration, but the same test, see .cnf for details)
|
||||
add_test_script(bug585 bug587 bug585 LABELS regexfilter REPL_BACKEND)
|
||||
add_test_derived(bug585 bug587 bug585 LABELS regexfilter REPL_BACKEND)
|
||||
add_test_executable(bug587.cpp bug587 bug587 LABELS regexfilter hintfilter REPL_BACKEND)
|
||||
add_test_script(bug587_1 bug587 bug587_1 LABELS regexfilter hintfilter REPL_BACKEND)
|
||||
add_test_derived(bug587_1 bug587 bug587_1 LABELS regexfilter hintfilter REPL_BACKEND)
|
||||
|
||||
# Tries to connect Maxscale when all slaves stopped
|
||||
add_test_executable(bug592.cpp bug592 replication LABELS MySQLAuth readwritesplit REPL_BACKEND)
|
||||
@ -342,16 +328,16 @@ add_test_executable(load_balancing.cpp load_balancing load LABELS readwritesplit
|
||||
add_test_executable(load_balancing_galera.cpp load_balancing_galera load_galera LABELS readwritesplit GALERA_BACKEND)
|
||||
|
||||
# Check load balancing parameters with Galera backend and 1 persistent connection
|
||||
add_test_script(load_balancing_galera_pers1 load_balancing_galera load_galera_pers1 LABELS readwritesplit HEAVY GALERA_BACKEND)
|
||||
add_test_derived(load_balancing_galera_pers1 load_balancing_galera load_galera_pers1 LABELS readwritesplit HEAVY GALERA_BACKEND)
|
||||
|
||||
# Check load balancing parameters with Galera backend and 10 persistent connections
|
||||
add_test_script(load_balancing_galera_pers10 load_balancing_galera load_galera_pers10 LABELS readwritesplit HEAVY GALERA_BACKEND)
|
||||
add_test_derived(load_balancing_galera_pers10 load_balancing_galera load_galera_pers10 LABELS readwritesplit HEAVY GALERA_BACKEND)
|
||||
|
||||
# Check load balancing parameters with 1 persistent connection
|
||||
add_test_script(load_balancing_pers1 load_balancing load_pers1 LABELS readwritesplit HEAVY REPL_BACKEND)
|
||||
add_test_derived(load_balancing_pers1 load_balancing load_pers1 LABELS readwritesplit HEAVY REPL_BACKEND)
|
||||
|
||||
# Check load balancing parameters with 10 persistent connections
|
||||
add_test_script(load_balancing_pers10 load_balancing load_pers10 LABELS readwritesplit HEAVY REPL_BACKEND)
|
||||
add_test_derived(load_balancing_pers10 load_balancing load_pers10 LABELS readwritesplit HEAVY REPL_BACKEND)
|
||||
|
||||
# Test with extremely big blob inserting
|
||||
add_test_executable(longblob.cpp longblob longblob LABELS readwritesplit readconnroute UNSTABLE HEAVY REPL_BACKEND)
|
||||
@ -431,7 +417,7 @@ add_test_executable(binary_ps_cursor.cpp binary_ps_cursor replication LABELS rea
|
||||
add_test_executable(mxs321.cpp mxs321 replication LABELS maxscale readwritesplit REPL_BACKEND)
|
||||
|
||||
# Crash with Galera and backend restart when persistant cfonnections are in use
|
||||
add_test_script(mxs361 pers_02 mxs361 mxs361 LABELS maxscale readwritesplit GALERA_BACKEND)
|
||||
add_test_derived(mxs361 pers_02 mxs361 mxs361 LABELS maxscale GALERA_BACKEND)
|
||||
|
||||
# Load huge file with 'LOAD DATA LOCAL INFILE'
|
||||
add_test_executable(mxs365.cpp mxs365 replication LABELS readwritesplit REPL_BACKEND)
|
||||
@ -440,7 +426,7 @@ add_test_executable(mxs365.cpp mxs365 replication LABELS readwritesplit REPL_BAC
|
||||
add_test_executable(mxs37_table_privilege.cpp mxs37_table_privilege replication LABELS MySQLAuth LIGHT REPL_BACKEND)
|
||||
|
||||
# Connect to Maxscale with user with only 'SELECT' priveledge (Galera backend)
|
||||
add_test_script(mxs37_table_privilege_galera mxs37_table_privilege galera LABELS MySQLAuth GALERA_BACKEND)
|
||||
add_test_derived(mxs37_table_privilege_galera mxs37_table_privilege galera LABELS MySQLAuth GALERA_BACKEND)
|
||||
|
||||
# Connect repeatedly to Schema router and execute simple query, check if auth is ok
|
||||
add_test_executable(mxs431.cpp mxs431 sharding LABELS schemarouter REPL_BACKEND BREAKS_REPL)
|
||||
@ -477,7 +463,7 @@ add_test_executable(mxs657_restart_service.cpp mxs657_restart_service replicatio
|
||||
add_test_executable(mxs682_cyrillic.cpp mxs682_cyrillic replication LABELS maxscale LIGHT REPL_BACKEND)
|
||||
|
||||
# put cyrillic letters to the table and check from backend (Galera backend)
|
||||
add_test_script(mxs682_cyrillic_galera mxs682_cyrillic galera LABELS maxscale GALERA_BACKEND)
|
||||
add_test_derived(mxs682_cyrillic_galera mxs682_cyrillic galera LABELS maxscale GALERA_BACKEND)
|
||||
|
||||
# Connect using different default database using user with database and table level grants
|
||||
add_test_executable(mxs716.cpp mxs716 replication LABELS MySQLAuth LIGHT REPL_BACKEND)
|
||||
@ -810,7 +796,7 @@ add_test_executable(sharding_load_data.cpp sharding_load_data sharding LABELS sc
|
||||
add_test_executable(short_sessions.cpp short_sessions replication LABELS readwritesplit readconnroute REPL_BACKEND)
|
||||
|
||||
# Do short sessions (open conn, short query, close conn) in the loop, client ssl is ON
|
||||
add_test_script(short_sessions_ssl short_sessions ssl LABELS readwritesplit readconnroute REPL_BACKEND)
|
||||
add_test_derived(short_sessions_ssl short_sessions ssl LABELS readwritesplit readconnroute REPL_BACKEND)
|
||||
|
||||
# Regression case for crash if maxadmin 'show monitors' command is issued, but no monitor is not running
|
||||
add_test_executable(show_monitor_crash.cpp show_monitor_crash show_monitor_crash LABELS maxscale)
|
||||
@ -822,13 +808,13 @@ add_test_executable(slave_failover.cpp slave_failover replication.one_slave LABE
|
||||
add_test_executable(sql_queries.cpp sql_queries replication LABELS readwritesplit REPL_BACKEND)
|
||||
|
||||
# Execute queries of different size, check data is the same when accessing via Maxscale and directly to backend, one persistant connection configured
|
||||
add_test_script(sql_queries_pers1 sql_queries sql_queries_pers1 LABELS maxscale readwritesplit HEAVY REPL_BACKEND)
|
||||
add_test_derived(sql_queries_pers1 sql_queries sql_queries_pers1 LABELS maxscale readwritesplit HEAVY REPL_BACKEND)
|
||||
|
||||
# Execute queries of different size, check data is the same when accessing via Maxscale and directly to backend, 10 persistant connections configured
|
||||
add_test_script(sql_queries_pers10 sql_queries sql_queries_pers10 LABELS maxscale readwritesplit HEAVY REPL_BACKEND)
|
||||
add_test_derived(sql_queries_pers10 sql_queries sql_queries_pers10 LABELS maxscale readwritesplit HEAVY REPL_BACKEND)
|
||||
|
||||
# Execute queries of different size, check data is the same when accessing via Maxscale and directly to backend, client ssl is ON
|
||||
add_test_script(ssl sql_queries ssl LABELS maxscale readwritesplit REPL_BACKEND)
|
||||
add_test_derived(ssl sql_queries ssl LABELS maxscale readwritesplit REPL_BACKEND)
|
||||
|
||||
|
||||
# Check load balancing, client ssl is ON
|
||||
@ -877,13 +863,13 @@ add_test_executable(binlog_incompl.cpp binlog_incompl binlog_incompl LABELS binl
|
||||
add_test_executable(binlog_semisync.cpp binlog_semisync setup_binlog_semisync LABELS binlogrouter HEAVY BREAKS_REPL)
|
||||
|
||||
# configure binlog router setup, execute queries and transactions, check data; install semysync plugin, router options semisync=0,transaction_safety=0
|
||||
add_test_script(binlog_semisync_txs0_ss0 binlog_semisync setup_binlog_semisync_txs0_ss0 LABELS binlogrouter HEAVY BREAKS_REPL)
|
||||
add_test_derived(binlog_semisync_txs0_ss0 binlog_semisync setup_binlog_semisync_txs0_ss0 LABELS binlogrouter HEAVY BREAKS_REPL)
|
||||
|
||||
# configure binlog router setup, execute queries and transactions, check data; install semysync plugin, router options semisync=0,transaction_safety=1
|
||||
add_test_script(binlog_semisync_txs0_ss1 binlog_semisync setup_binlog_semisync_txs0_ss1 LABELS binlogrouter HEAVY BREAKS_REPL)
|
||||
add_test_derived(binlog_semisync_txs0_ss1 binlog_semisync setup_binlog_semisync_txs0_ss1 LABELS binlogrouter HEAVY BREAKS_REPL)
|
||||
|
||||
# configure binlog router setup, execute queries and transactions, check data; install semysync plugin, router options semisync=1,transaction_safety=0
|
||||
add_test_script(binlog_semisync_txs1_ss0 binlog_semisync setup_binlog_semisync_txs1_ss0 LABELS binlogrouter HEAVY BREAKS_REPL)
|
||||
add_test_derived(binlog_semisync_txs1_ss0 binlog_semisync setup_binlog_semisync_txs1_ss0 LABELS binlogrouter HEAVY BREAKS_REPL)
|
||||
|
||||
set_tests_properties(binlog_semisync PROPERTIES TIMEOUT 3600)
|
||||
set_tests_properties(binlog_semisync_txs0_ss0 PROPERTIES TIMEOUT 3600)
|
||||
@ -974,6 +960,9 @@ add_test_executable(local_address.cpp local_address local_address LABELS REPL_BA
|
||||
# https://jira.mariadb.org/browse/MXS-1628
|
||||
add_test_executable(mxs1628_bad_handshake.cpp mxs1628_bad_handshake replication LABELS REPL_BACKEND)
|
||||
|
||||
# MXS-1836: MaxInfo "show eventTimes" returns garbage.
|
||||
add_test_executable(mxs1836_show_eventTimes.cpp mxs1836_show_eventTimes mxs1836_show_eventTimes LABELS REPL_BACKEND)
|
||||
|
||||
configure_file(templates.h.in templates.h @ONLY)
|
||||
|
||||
include(CTest)
|
||||
|
@ -8,7 +8,8 @@
|
||||
|
||||
|
||||
rp=`realpath $0`
|
||||
export test_dir=`dirname $rp`
|
||||
export src_dir=`dirname $rp`
|
||||
export test_dir=`pwd`
|
||||
export test_name=`basename $rp`
|
||||
|
||||
$test_dir/non_native_setup $test_name
|
||||
@ -17,7 +18,7 @@ if [ $? -ne 0 ] ; then
|
||||
echo "configuring maxscale failed"
|
||||
exit 1
|
||||
fi
|
||||
export ssl_options="--ssl-cert=$test_dir/ssl-cert/client-cert.pem --ssl-key=$test_dir/ssl-cert/client-key.pem"
|
||||
export ssl_options="--ssl-cert=$src_dir/ssl-cert/client-cert.pem --ssl-key=$src_dir/ssl-cert/client-key.pem"
|
||||
|
||||
#echo "Waiting for 15 seconds"
|
||||
#sleep 15
|
||||
@ -69,5 +70,5 @@ else
|
||||
echo "Messages are same"
|
||||
fi
|
||||
|
||||
$test_dir/copy_logs.sh bug561
|
||||
$src_dir/copy_logs.sh bug561
|
||||
exit $res
|
||||
|
@ -6,7 +6,8 @@
|
||||
## - compare error messages
|
||||
|
||||
rp=`realpath $0`
|
||||
export test_dir=`dirname $rp`
|
||||
export src_dir=`dirname $rp`
|
||||
export test_dir=`pwd`
|
||||
export test_name=`basename $rp`
|
||||
|
||||
$test_dir/non_native_setup $test_name
|
||||
@ -15,7 +16,7 @@ if [ $? -ne 0 ] ; then
|
||||
echo "configuring maxscale failed"
|
||||
exit 1
|
||||
fi
|
||||
export ssl_options="--ssl-cert=$test_dir/ssl-cert/client-cert.pem --ssl-key=$test_dir/ssl-cert/client-key.pem"
|
||||
export ssl_options="--ssl-cert=$src_dir/ssl-cert/client-cert.pem --ssl-key=$src_dir/ssl-cert/client-key.pem"
|
||||
|
||||
mariadb_err=`mysql -u no_such_user -psome_pwd -h $node_001_network $ssl_option --socket=$node_000_socket test 2>&1`
|
||||
maxscale_err=`mysql -u no_such_user -psome_pwd -h $maxscale_IP -P 4006 $ssl_options test 2>&1`
|
||||
@ -38,5 +39,5 @@ else
|
||||
res=0
|
||||
fi
|
||||
|
||||
$test_dir/copy_logs.sh bug562
|
||||
$src_dir/copy_logs.sh bug562
|
||||
exit $res
|
||||
|
@ -6,7 +6,8 @@
|
||||
## - check output of SHOW VARIABLES LIKE 'char%'
|
||||
|
||||
rp=`realpath $0`
|
||||
export test_dir=`dirname $rp`
|
||||
export src_dir=`dirname $rp`
|
||||
export test_dir=`pwd`
|
||||
export test_name=`basename $rp`
|
||||
$test_dir/non_native_setup $test_name
|
||||
|
||||
@ -14,7 +15,7 @@ if [ $? -ne 0 ] ; then
|
||||
echo "configuring maxscale failed"
|
||||
exit 1
|
||||
fi
|
||||
export ssl_options="--ssl-cert=$test_dir/ssl-cert/client-cert.pem --ssl-key=$test_dir/ssl-cert/client-key.pem"
|
||||
export ssl_options="--ssl-cert=$src_dir/ssl-cert/client-cert.pem --ssl-key=$src_dir/ssl-cert/client-key.pem"
|
||||
|
||||
for char_set in "latin1" "latin2"
|
||||
do
|
||||
@ -34,11 +35,9 @@ do
|
||||
if [[ $res1 != 0 ]] || [[ $res2 != 0 ]] || [[ $res3 != 0 ]] ; then
|
||||
echo "charset is ignored"
|
||||
mysql -u$node_user -p$node_password -h $maxscale_IP -P 4006 $ssl_options --default-character-set="latin2" -e "SHOW VARIABLES LIKE 'char%'"
|
||||
$test_dir/copy_logs.sh bug564
|
||||
$src_dir/copy_logs.sh bug564
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
$test_dir/copy_logs.sh bug564
|
||||
$src_dir/copy_logs.sh bug564
|
||||
exit 0
|
||||
|
||||
|
||||
|
@ -6,7 +6,8 @@
|
||||
## check if Maxscale is alive
|
||||
|
||||
rp=`realpath $0`
|
||||
export test_dir=`dirname $rp`
|
||||
export src_dir=`dirname $rp`
|
||||
export test_dir=`pwd`
|
||||
export test_name=`basename $rp`
|
||||
$test_dir/non_native_setup $test_name
|
||||
|
||||
@ -14,7 +15,7 @@ if [ $? -ne 0 ] ; then
|
||||
echo "configuring maxscale failed"
|
||||
exit 1
|
||||
fi
|
||||
export ssl_options="--ssl-cert=$test_dir/ssl-cert/client-cert.pem --ssl-key=$test_dir/ssl-cert/client-key.pem"
|
||||
export ssl_options="--ssl-cert=$src_dir/ssl-cert/client-cert.pem --ssl-key=$src_dir/ssl-cert/client-key.pem"
|
||||
|
||||
#pid=`ssh -i $maxscale_sshkey -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $maxscale_access_user@$maxscale_IP "pgrep maxscale"`
|
||||
#echo "Maxscale pid is $pid"
|
||||
@ -29,6 +30,6 @@ echo "checking if Maxscale is alive"
|
||||
echo "show databases;" | mysql -u$node_user -p$node_password -h $maxscale_IP -P 4006 $ssl_options
|
||||
res=$?
|
||||
|
||||
$test_dir/copy_logs.sh bug567
|
||||
$src_dir/copy_logs.sh bug567
|
||||
exit $res
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
rp=`realpath $0`
|
||||
export src_dir=`dirname $rp`
|
||||
|
||||
user=skysql
|
||||
password=skysql
|
||||
|
||||
@ -15,18 +18,20 @@ function run_test
|
||||
local test_name=$1
|
||||
|
||||
echo $test_name
|
||||
logdir=log_$test_name
|
||||
mkdir -p $logdir
|
||||
|
||||
mysqltest --host=$maxscale_IP --port=$port \
|
||||
--user=$user --password=$password \
|
||||
--logdir=log \
|
||||
--test-file=t/$test_name.test \
|
||||
--result-file=r/$test_name.result \
|
||||
--logdir=$logdir \
|
||||
--test-file=$dir/t/$test_name.test \
|
||||
--result-file=$dir/r/$test_name.result \
|
||||
--silent
|
||||
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
echo " OK"
|
||||
rc=0
|
||||
rc=0
|
||||
else
|
||||
echo " FAILED"
|
||||
rc=1
|
||||
@ -57,7 +62,9 @@ then
|
||||
echo "warning: Expected test name to be $expected_name_basic, was $1."
|
||||
fi
|
||||
|
||||
source=cache/$1/cache_rules.json
|
||||
export dir="$src_dir/cache/$expected_name"
|
||||
|
||||
source=$src_dir/cache/$1/cache_rules.json
|
||||
target=vagrant@$maxscale_IP:/home/$maxscale_access_user/cache_rules.json
|
||||
|
||||
if [ $maxscale_IP != "127.0.0.1" ] ; then
|
||||
@ -78,11 +85,6 @@ test_dir=`pwd`
|
||||
|
||||
$test_dir/non_native_setup $1
|
||||
|
||||
cd cache/$expected_name
|
||||
|
||||
[ -d log ] && rm -r log
|
||||
mkdir log || exit 1
|
||||
|
||||
echo
|
||||
|
||||
# We sleep slightly longer than the TTL to ensure that the TTL mechanism
|
||||
|
@ -31,6 +31,10 @@ int main(int argc, char *argv[])
|
||||
Test->try_query(Test->maxscales->conn_rwsplit[0], (char *) "DROP TABLE IF EXISTS t1");
|
||||
Test->try_query(Test->maxscales->conn_rwsplit[0], (char *) "CREATE TABLE t1 (x1 int, fl int)");
|
||||
|
||||
Test->maxscales->restart_maxscale();
|
||||
sleep(2);
|
||||
Test->maxscales->connect_maxscale(0);
|
||||
|
||||
Test->tprintf("Changing user... \n");
|
||||
Test->add_result(mysql_change_user(Test->maxscales->conn_rwsplit[0], (char *) "user", (char *) "pass2", (char *) "test") ,
|
||||
"changing user failed \n");
|
||||
@ -60,9 +64,9 @@ int main(int argc, char *argv[])
|
||||
Test->add_result(1, "There is no proper error message\n");
|
||||
}
|
||||
|
||||
Test->tprintf("Trying INSERT again (expecting success - use change should fail)... \n");
|
||||
Test->try_query(Test->maxscales->conn_rwsplit[0], (char *) "INSERT INTO t1 VALUES (77, 13);");
|
||||
|
||||
Test->tprintf("Trying INSERT again (expecting failure - change user should have failed)...");
|
||||
Test->add_result(!execute_query(Test->maxscales->conn_rwsplit[0], (char *) "INSERT INTO t1 VALUES (77, 13);"),
|
||||
"Query should fail, MaxScale should disconnect on auth failure");
|
||||
|
||||
Test->tprintf("Changing user with wrong password using ReadConn \n");
|
||||
if (mysql_change_user(Test->maxscales->conn_slave[0], (char *) "user", (char *) "wrong_pass2", (char *) "test") == 0)
|
||||
@ -79,6 +83,7 @@ int main(int argc, char *argv[])
|
||||
Test->add_result(mysql_change_user(Test->maxscales->conn_slave[0], (char *) "user", (char *) "pass2", (char *) "test") ,
|
||||
"changing user failed \n");
|
||||
|
||||
Test->maxscales->connect_maxscale(0);
|
||||
Test->try_query(Test->maxscales->conn_rwsplit[0], (char *) "DROP USER user@'%%';");
|
||||
execute_query_silent(Test->maxscales->conn_rwsplit[0], "DROP TABLE test.t1");
|
||||
|
||||
|
@ -0,0 +1,24 @@
|
||||
[maxscale]
|
||||
threads=1
|
||||
|
||||
[MaxAdmin]
|
||||
type=service
|
||||
router=cli
|
||||
|
||||
[MaxAdmin-Listener]
|
||||
type=listener
|
||||
service=MaxAdmin
|
||||
protocol=maxscaled
|
||||
socket=default
|
||||
|
||||
[MaxInfo]
|
||||
type=service
|
||||
router=maxinfo
|
||||
user=maxinfo_user
|
||||
passwd=maxinfo_passwd
|
||||
|
||||
[MaxInfo-Listener]
|
||||
type=listener
|
||||
service=MaxInfo
|
||||
protocol=MySQLClient
|
||||
port=9003
|
@ -1,4 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
rp=`realpath $0`
|
||||
export src_dir=`dirname $rp`
|
||||
|
||||
./non_native_setup insertstream
|
||||
./mysqltest_driver.sh insertstream insertstream 4006
|
||||
|
||||
$src_dir/mysqltest_driver.sh insertstream $src_dir/insertstream 4006
|
||||
|
@ -1,29 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
rp=`realpath $0`
|
||||
export test_dir=`dirname $rp`
|
||||
export src_dir=`dirname $rp`
|
||||
export test_dir=`pwd`
|
||||
export test_name=`basename $rp`
|
||||
$test_dir/non_native_setup $test_name
|
||||
export ssl_options="--ssl-cert=$test_dir/ssl-cert/client-cert.pem --ssl-key=$test_dir/ssl-cert/client-key.pem"
|
||||
export ssl_options="--ssl-cert=$src_dir/ssl-cert/client-cert.pem --ssl-key=$src_dir/ssl-cert/client-key.pem"
|
||||
|
||||
IP=$Maxscale_IP
|
||||
|
||||
mysql -h $IP -P 4006 -u $node_user -p$node_password $ssl_options < $test_dir/long_insert_sql/test_init.sql
|
||||
mysql -h $IP -P 4006 -u $node_user -p$node_password $ssl_options < $src_dir/long_insert_sql/test_init.sql
|
||||
|
||||
echo "RWSplit router:"
|
||||
for ((i=0 ; i<1000 ; i++)) ; do
|
||||
echo "iteration: $i"
|
||||
mysql -h $IP -P 4006 -u $node_user -p$node_password $ssl_options < $test_dir/long_insert_sql/test_query.sql
|
||||
mysql -h $IP -P 4006 -u $node_user -p$node_password $ssl_options < $src_dir/long_insert_sql/test_query.sql
|
||||
done
|
||||
|
||||
echo "ReadConn router (master):"
|
||||
for ((i=0 ; i<1000 ; i++)) ; do
|
||||
echo "iteration: $i"
|
||||
mysql -h $IP -P 4008 -u $node_user -p$node_uassword $ssl_options < $test_dir/long_insert_sql/test_query.sql
|
||||
mysql -h $IP -P 4008 -u $node_user -p$node_uassword $ssl_options < $src_dir/long_insert_sql/test_query.sql
|
||||
done
|
||||
|
||||
|
||||
res=$?
|
||||
|
||||
$test_dir/copy_logs.sh long_insert
|
||||
$src_dir/copy_logs.sh long_insert
|
||||
exit $res
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
|
||||
#include "mariadb_func.h"
|
||||
#include "templates.h"
|
||||
#include <ctype.h>
|
||||
#include <sstream>
|
||||
|
||||
@ -20,20 +21,11 @@ int set_ssl(MYSQL* conn)
|
||||
char client_key[1024];
|
||||
char client_cert[1024];
|
||||
char ca[1024];
|
||||
char* test_dir = getenv("test_dir");
|
||||
|
||||
if (test_dir == NULL)
|
||||
{
|
||||
sprintf(client_key, "./ssl-cert/client-key.pem");
|
||||
sprintf(client_cert, "./ssl-cert/client-cert.pem");
|
||||
sprintf(ca, "./ssl-cert/ca.pem");
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(client_key, "%s/ssl-cert/client-key.pem", test_dir);
|
||||
sprintf(client_cert, "%s/ssl-cert/client-cert.pem", test_dir);
|
||||
sprintf(ca, "%s/ssl-cert/ca.pem", test_dir);
|
||||
}
|
||||
sprintf(client_key, "%s/ssl-cert/client-key.pem", test_dir);
|
||||
sprintf(client_cert, "%s/ssl-cert/client-cert.pem", test_dir);
|
||||
sprintf(ca, "%s/ssl-cert/ca.pem", test_dir);
|
||||
|
||||
return mysql_ssl_set(conn, client_key, client_cert, ca, NULL, NULL);
|
||||
}
|
||||
|
||||
|
@ -4,15 +4,20 @@
|
||||
#
|
||||
# TODO: Don't test correctness of routing with mysqltest
|
||||
#
|
||||
rp=`realpath $0`
|
||||
export src_dir=`dirname $rp`
|
||||
|
||||
# TODO: Don't copy this and "unmangle" the test instead
|
||||
cp -r $src_dir/Hartmut_tests/maxscale-mysqltest ./Hartmut_tests/maxscale-mysqltest/
|
||||
|
||||
master_id=`echo "SELECT @@server_id" | mysql -u$node_user -p$node_password -h $node_000_network $ssl_options -P $node_000_port | tail -n1`
|
||||
echo "--disable_query_log" > Hartmut_tests/maxscale-mysqltest/testconf.inc
|
||||
echo "SET @TMASTER_ID=$master_id;" >> Hartmut_tests/maxscale-mysqltest/testconf.inc
|
||||
echo "--enable_query_log" >> Hartmut_tests/maxscale-mysqltest/testconf.inc
|
||||
|
||||
./mysqltest_driver.sh $1 Hartmut_tests/maxscale-mysqltest 4006
|
||||
$src_dir/mysqltest_driver.sh $1 $PWD/Hartmut_tests/maxscale-mysqltest 4006
|
||||
|
||||
ret=$?
|
||||
./copy_logs.sh $1
|
||||
$src_dir/copy_logs.sh $1
|
||||
|
||||
exit $ret
|
||||
|
@ -19,7 +19,8 @@ then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
source=masking/$1/masking_rules.json
|
||||
src_dir=$(dirname $(realpath $0))
|
||||
source=$src_dir/masking/$1/masking_rules.json
|
||||
target=$maxscale_access_user@$maxscale_IP:/home/$maxscale_access_user/masking_rules.json
|
||||
|
||||
if [ $maxscale_IP != "127.0.0.1" ] ; then
|
||||
@ -55,4 +56,4 @@ fi
|
||||
# [Read Connection Listener Master] in cnf/maxscale.maxscale.cnf.template.$1
|
||||
port=4008
|
||||
|
||||
./mysqltest_driver.sh $1 ./masking/$1 $port $user $password
|
||||
$src_dir/mysqltest_driver.sh $1 $src_dir/masking/$1 $port $user $password
|
||||
|
@ -17,7 +17,9 @@ then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
source=masking/$1/masking_rules.json
|
||||
src_dir=$(dirname $(realpath $0))
|
||||
echo "src_dir: $src_dir"
|
||||
source=$src_dir/masking/$1/masking_rules.json
|
||||
target=vagrant@$maxscale_IP:/home/$maxscale_access_user/masking_rules.json
|
||||
|
||||
if [ $maxscale_IP != "127.0.0.1" ] ; then
|
||||
@ -37,22 +39,23 @@ echo $source copied to $target
|
||||
test_dir=`pwd`
|
||||
|
||||
$test_dir/non_native_setup $1
|
||||
|
||||
cd masking/$1
|
||||
[ -d log ] && rm -r log
|
||||
mkdir log || exit 1
|
||||
logdir=log_$1
|
||||
[ -d $logdir ] && rm -r $logdir
|
||||
mkdir $logdir || exit 1
|
||||
|
||||
# [Read Connection Listener Master] in cnf/maxscale.maxscale.cnf.template.$1
|
||||
port=4008
|
||||
password=skysql
|
||||
|
||||
dir="$src_dir/masking/$1"
|
||||
|
||||
user=skysql
|
||||
test_name=masking_user
|
||||
mysqltest --host=$maxscale_IP --port=$port \
|
||||
--user=$user --password=$password \
|
||||
--logdir=log \
|
||||
--test-file=t/$test_name.test \
|
||||
--result-file=r/"$test_name"_"$user".result \
|
||||
--logdir=$logdir \
|
||||
--test-file=$dir/t/$test_name.test \
|
||||
--result-file=$dir/r/"$test_name"_"$user".result \
|
||||
--silent
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
@ -66,9 +69,9 @@ user=maxskysql
|
||||
test_name=masking_user
|
||||
mysqltest --host=$maxscale_IP --port=$port \
|
||||
--user=$user --password=$password \
|
||||
--logdir=log \
|
||||
--test-file=t/$test_name.test \
|
||||
--result-file=r/"$test_name"_"$user".result \
|
||||
--logdir=$logdir \
|
||||
--test-file=$dir/t/$test_name.test \
|
||||
--result-file=$dir/r/"$test_name"_"$user".result \
|
||||
--silent
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
@ -81,6 +84,6 @@ fi
|
||||
echo
|
||||
|
||||
# Copy logs from the VM
|
||||
$test_dir/copy_logs.sh $1
|
||||
$src_dir/copy_logs.sh $1
|
||||
|
||||
exit $res
|
||||
|
@ -65,7 +65,8 @@ ulimit -c unlimited
|
||||
if [ $res == 0 ] ; then
|
||||
. ${script_dir}/set_env.sh $name
|
||||
cd ${script_dir}/..
|
||||
cmake . -DBUILDNAME=$name -DCMAKE_BUILD_TYPE=Debug
|
||||
mkdir build && cd build
|
||||
cmake .. -DBUILDNAME=$name -DCMAKE_BUILD_TYPE=Debug
|
||||
make
|
||||
|
||||
if [ ! -z "${named_test}" ] ; then
|
||||
|
@ -73,7 +73,9 @@ checkExitStatus $? "Error installing Maxscale" $snapshot_lock_file
|
||||
|
||||
cd ${script_dir}/..
|
||||
|
||||
cmake . -DBUILDNAME=$JOB_NAME-$BUILD_NUMBER-$target
|
||||
rm -rf build
|
||||
mkdir build && cd build
|
||||
cmake .. -DBUILDNAME=$JOB_NAME-$BUILD_NUMBER-$target
|
||||
make
|
||||
|
||||
./check_backend --restart-galera
|
||||
|
@ -68,8 +68,10 @@ int main(int argc, char* argv[])
|
||||
TestConnections::skip_maxscale_start(true);
|
||||
|
||||
TestConnections test(argc, argv);
|
||||
std::string src = test_dir;
|
||||
src += "/mxs1719.json";
|
||||
|
||||
if (test.maxscales->copy_to_node(0, "./mxs1719.json", "/home/vagrant/mxs1719.json") == 0)
|
||||
if (test.maxscales->copy_to_node(0, src.c_str(), "/home/vagrant/mxs1719.json") == 0)
|
||||
{
|
||||
if (test.maxscales->start() == 0)
|
||||
{
|
||||
|
84
maxscale-system-test/mxs1836_show_eventTimes.cpp
Normal file
84
maxscale-system-test/mxs1836_show_eventTimes.cpp
Normal file
@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (c) 2016 MariaDB Corporation Ab
|
||||
*
|
||||
* Use of this software is governed by the Business Source License included
|
||||
* in the LICENSE.TXT file and at www.mariadb.com/bsl11.
|
||||
*
|
||||
* Change Date: 2020-01-01
|
||||
*
|
||||
* On the date above, in accordance with the Business Source License, use
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include "testconnections.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
// Specified in the configuration file.
|
||||
char USER[] = "maxinfo_user";
|
||||
char PASSWD[] = "maxinfo_passwd";
|
||||
int PORT = 9003;
|
||||
|
||||
void run(TestConnections& test, MYSQL* pMysql)
|
||||
{
|
||||
if (mysql_query(pMysql, "show eventTimes") == 0)
|
||||
{
|
||||
MYSQL_RES* pResult = mysql_store_result(pMysql);
|
||||
test.assert(pResult, "Executing 'show eventTimes' returned no result.");
|
||||
|
||||
if (pResult)
|
||||
{
|
||||
int nFields = mysql_field_count(pMysql);
|
||||
test.assert(nFields == 3, "Expected 3 fields, got %d.", nFields);
|
||||
|
||||
MYSQL_ROW row;
|
||||
while ((row = mysql_fetch_row(pResult)) != NULL)
|
||||
{
|
||||
cout << row[0] << ", " << row[1] << ", " << row[2] << endl;
|
||||
|
||||
// Right after startup, so all numbers should be small.
|
||||
// The regression caused garbage to be returned, so they
|
||||
// were all over the place.
|
||||
int64_t nEvents_queued = strtoll(row[1], NULL, 0);
|
||||
int64_t nEvents_executed = strtoll(row[2], NULL, 0);
|
||||
|
||||
test.assert(nEvents_queued >= 0 && nEvents_queued < 100,
|
||||
"Suspiciously large number of 'No. Events Queued'.");
|
||||
test.assert(nEvents_executed >= 0 && nEvents_executed < 100,
|
||||
"Suspiciously large number of 'No. Events Executed'.");
|
||||
}
|
||||
|
||||
mysql_free_result(pResult);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
test.assert(false, "Executing 'show eventTimes' failed.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
TestConnections test(argc, argv);
|
||||
|
||||
const char* zMaxScale_host = test.maxscales->ip(0);
|
||||
|
||||
MYSQL* pMysql = open_conn_no_db(PORT, zMaxScale_host, USER, PASSWD);
|
||||
test.assert(pMysql, "Could not connect to maxinfo on MaxScale.");
|
||||
|
||||
if (pMysql)
|
||||
{
|
||||
run(test, pMysql);
|
||||
|
||||
mysql_close(pMysql);
|
||||
}
|
||||
|
||||
return test.global_result;
|
||||
}
|
@ -5,7 +5,7 @@
|
||||
## - connects to Maxscale, checks that defined in cmd line DB is selected
|
||||
|
||||
rp=`realpath $0`
|
||||
export test_dir=`dirname $rp`
|
||||
export test_dir=`pwd`
|
||||
export test_name="mxs791.sh"
|
||||
echo test name is $test_name
|
||||
|
||||
|
@ -1,11 +1,14 @@
|
||||
#!/bin/bash
|
||||
$test_dir/non_native_setup $test_name
|
||||
|
||||
rp=`realpath $0`
|
||||
export src_dir=`dirname $rp`
|
||||
$PWD/non_native_setup $test_name
|
||||
|
||||
if [ $? -ne 0 ] ; then
|
||||
echo "configuring maxscale failed"
|
||||
exit 1
|
||||
fi
|
||||
export ssl_options="--ssl-cert=$test_dir/ssl-cert/client-cert.pem --ssl-key=$test_dir/ssl-cert/client-key.pem"
|
||||
export ssl_options="--ssl-cert=$src_dir/ssl-cert/client-cert.pem --ssl-key=$src_dir/ssl-cert/client-key.pem"
|
||||
|
||||
res=0
|
||||
echo "Trying RWSplit"
|
||||
|
@ -5,7 +5,7 @@
|
||||
## - connects to Maxscale, checks that defined in cmd line DB is selected
|
||||
|
||||
rp=`realpath $0`
|
||||
export test_dir=`dirname $rp`
|
||||
export test_dir=`pwd`
|
||||
export test_name="mxs791_galera.sh"
|
||||
echo test name is $test_name
|
||||
|
||||
|
@ -22,7 +22,7 @@ int main(int argc, char *argv[])
|
||||
MYSQL *conn = open_conn(test->maxscales->readconn_master_port[0], test->maxscales->IP[0],
|
||||
test->maxscales->user_name,
|
||||
test->maxscales->password, true);
|
||||
test->add_result(execute_query(conn, "select @@server_id"), "SSL query failed");
|
||||
test->add_result(execute_query(conn, "select @@server_id"), "SSL query to readconnroute failed");
|
||||
mysql_close(conn);
|
||||
|
||||
test->check_maxscale_processes(0, 1);
|
||||
|
@ -36,26 +36,24 @@ fi
|
||||
test_dir=`pwd`
|
||||
port=$3
|
||||
|
||||
cd $2 || exit 1
|
||||
|
||||
res=0
|
||||
|
||||
# Create a directory for the mysqltest logs
|
||||
[ -d log ] && rm -r log
|
||||
mkdir log || exit 1
|
||||
[ -d log_$1 ] && rm -r log_$1
|
||||
mkdir log_$1
|
||||
|
||||
echo
|
||||
|
||||
# Run the test
|
||||
for t in `cd t; ls *.test`
|
||||
for t in `$2/t/*.test|xargs -L 1 basename`
|
||||
do
|
||||
printf "$t:"
|
||||
test_name=${t%%.test}
|
||||
mysqltest --host=$maxscale_IP --port=$port \
|
||||
--user=$user --password=$password \
|
||||
--logdir=log \
|
||||
--test-file=t/$test_name.test \
|
||||
--result-file=r/$test_name.result \
|
||||
--logdir=log_$1 \
|
||||
--test-file=$2/t/$test_name.test \
|
||||
--result-file=$2/r/$test_name.result \
|
||||
--silent
|
||||
|
||||
if [ $? -eq 0 ]
|
||||
@ -70,6 +68,6 @@ done
|
||||
echo
|
||||
|
||||
# Copy logs from the VM
|
||||
$test_dir/copy_logs.sh $1
|
||||
$src_dir/copy_logs.sh $1
|
||||
|
||||
exit $res
|
||||
|
@ -5,7 +5,8 @@
|
||||
## check that Maxscale is reacting correctly on ctrc+c signal and termination does not take ages
|
||||
|
||||
rp=`realpath $0`
|
||||
export test_dir=`dirname $rp`
|
||||
export src_dir=`dirname $rp`
|
||||
export test_dir=`pwd`
|
||||
export test_name=`basename $rp`
|
||||
|
||||
if [ $maxscale_IP == "127.0.0.1" ] ; then
|
||||
@ -20,12 +21,12 @@ if [ $? -ne 0 ] ; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
scp -i $maxscale_sshkey -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -r $test_dir/test_ctrl_c/* $maxscale_access_user@$maxscale_IP:./
|
||||
scp -i $maxscale_sshkey -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -r $src_dir/test_ctrl_c/* $maxscale_access_user@$maxscale_IP:./
|
||||
ssh -i $maxscale_sshkey -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $maxscale_access_user@$maxscale_IP "export maxscale_access_sudo=$maxscale_access_sudo; ./test_ctrl_c.sh"
|
||||
|
||||
res=$?
|
||||
|
||||
ssh -i $maxscale_sshkey -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $maxscale_access_user@$maxscale_IP "sudo rm -f /tmp/maxadmin.sock"
|
||||
|
||||
$test_dir/copy_logs.sh run_ctrl_c
|
||||
$src_dir/copy_logs.sh run_ctrl_c
|
||||
exit $res
|
||||
|
@ -5,7 +5,8 @@
|
||||
## run a set of queries in the loop (see setmix.sql) using Perl client
|
||||
|
||||
rp=`realpath $0`
|
||||
export test_dir=`dirname $rp`
|
||||
export src_dir=`dirname $rp`
|
||||
export test_dir=`pwd`
|
||||
export test_name=`basename $rp`
|
||||
|
||||
$test_dir/non_native_setup $test_name
|
||||
@ -15,7 +16,7 @@ then
|
||||
echo "configuring maxscale failed"
|
||||
exit 1
|
||||
fi
|
||||
export ssl_options="--ssl-cert=$test_dir/ssl-cert/client-cert.pem --ssl-key=$test_dir/ssl-cert/client-key.pem"
|
||||
export ssl_options="--ssl-cert=$src_dir/ssl-cert/client-cert.pem --ssl-key=$src_dir/ssl-cert/client-key.pem"
|
||||
|
||||
echo "drop table if exists t1; create table t1(id integer primary key); " | mysql -u$node_user -p$node_password -h$maxscale_IP -P 4006 $ssl_options test
|
||||
|
||||
@ -27,8 +28,8 @@ fi
|
||||
|
||||
res=0
|
||||
|
||||
$test_dir/session_hang/run_setmix.sh &
|
||||
perl $test_dir/session_hang/simpletest.pl
|
||||
$src_dir/session_hang/run_setmix.sh &
|
||||
perl $src_dir/session_hang/simpletest.pl
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
res=1
|
||||
@ -52,6 +53,6 @@ else
|
||||
echo "Test PASSED"
|
||||
fi
|
||||
|
||||
$test_dir/copy_logs.sh run_session_hang
|
||||
$src_dir/copy_logs.sh run_session_hang
|
||||
|
||||
exit $res
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
rp=`realpath $0`
|
||||
export test_dir=`dirname $rp`
|
||||
export test_dir=`pwd`
|
||||
export test_name=`basename $rp`
|
||||
|
||||
$test_dir/non_native_setup $test_name
|
||||
|
@ -88,7 +88,6 @@ TestConnections::TestConnections(int argc, char *argv[]):
|
||||
#ifdef SIGBUS
|
||||
signal_set(SIGBUS, sigfatal_handler);
|
||||
#endif
|
||||
chdir(test_dir);
|
||||
gettimeofday(&start_time, NULL);
|
||||
|
||||
read_env();
|
||||
|
@ -19,7 +19,7 @@ function(add_test_executable source name template)
|
||||
add_template(${name} ${template})
|
||||
add_executable(${name} ${source})
|
||||
target_link_libraries(${name} testcore)
|
||||
add_test(NAME ${name} COMMAND ${name} ${name} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||
add_test(NAME ${name} COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${name} ${name} WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
|
||||
list(REMOVE_AT ARGV 0 1 2 3)
|
||||
|
||||
@ -37,13 +37,27 @@ function(add_test_executable_notest source name template)
|
||||
target_link_libraries(${name} testcore)
|
||||
endfunction()
|
||||
|
||||
# Add a test which uses another test as the executable
|
||||
function(add_test_derived name executable template)
|
||||
file(APPEND templates "${name} ${template}\n")
|
||||
add_template(${name} ${template})
|
||||
add_test(NAME ${name} COMMAND ${CMAKE_BINARY_DIR}/${executable} ${name} WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
|
||||
list(REMOVE_AT ARGV 0 1 2)
|
||||
|
||||
foreach (label IN LISTS ARGV)
|
||||
get_property(prev_labels TEST ${name} PROPERTY LABELS)
|
||||
set_property(TEST ${name} PROPERTY LABELS ${label} ${prev_labels})
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
# This function adds a script as a test with the specified name and template.
|
||||
# The naming of the templates follow the same principles as add_test_executable.
|
||||
# also suitable for symlinks
|
||||
function(add_test_script name script template labels)
|
||||
file(APPEND templates "${name} ${template}\n")
|
||||
add_template(${name} ${template})
|
||||
add_test(NAME ${name} COMMAND ${script} ${name} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||
add_test(NAME ${name} COMMAND ${CMAKE_SOURCE_DIR}/${script} ${name} WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
|
||||
list(REMOVE_AT ARGV 0 1 2)
|
||||
|
||||
|
@ -3545,7 +3545,7 @@ int create_new_monitor(CONFIG_CONTEXT *context, CONFIG_CONTEXT *obj, HASHTABLE*
|
||||
{
|
||||
MXS_NOTICE("Monitor '%s' is missing the '%s' parameter, "
|
||||
"using default value of %d milliseconds.",
|
||||
CN_MONITOR_INTERVAL, obj->object, DEFAULT_MONITOR_INTERVAL);
|
||||
obj->object, CN_MONITOR_INTERVAL, DEFAULT_MONITOR_INTERVAL);
|
||||
}
|
||||
|
||||
char *journal_age = config_get_value(obj->parameters, CN_JOURNAL_MAX_AGE);
|
||||
|
@ -930,20 +930,15 @@ static void server_parameter_free(SERVER_PARAM *tofree)
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a parameter value from a server
|
||||
* Same as server_get_parameter but doesn't lock the server
|
||||
*
|
||||
* @param server The server we are looking for a parameter of
|
||||
* @param name The name of the parameter we require
|
||||
* @param out Buffer where value is stored, use NULL to check if the parameter exists
|
||||
* @param size Size of @c out, ignored if @c out is NULL
|
||||
*
|
||||
* @return Length of the parameter value or 0 if parameter was not found
|
||||
* @note Should only be called when the server is already locked
|
||||
*/
|
||||
size_t server_get_parameter(const SERVER *server, const char *name, char* out, size_t size)
|
||||
size_t server_get_parameter_nolock(const SERVER *server, const char *name, char* out, size_t size)
|
||||
{
|
||||
int len = 0;
|
||||
ss_dassert(SPINLOCK_IS_LOCKED(&server->lock));
|
||||
size_t len = 0;
|
||||
SERVER_PARAM *param = server->parameters;
|
||||
spinlock_acquire(&server->lock);
|
||||
|
||||
while (param)
|
||||
{
|
||||
@ -955,6 +950,23 @@ size_t server_get_parameter(const SERVER *server, const char *name, char* out, s
|
||||
param = param->next;
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a parameter value from a server
|
||||
*
|
||||
* @param server The server we are looking for a parameter of
|
||||
* @param name The name of the parameter we require
|
||||
* @param out Buffer where value is stored, use NULL to check if the parameter exists
|
||||
* @param size Size of @c out, ignored if @c out is NULL
|
||||
*
|
||||
* @return Length of the parameter value or 0 if parameter was not found
|
||||
*/
|
||||
size_t server_get_parameter(const SERVER *server, const char *name, char* out, size_t size)
|
||||
{
|
||||
spinlock_acquire(&server->lock);
|
||||
size_t len = server_get_parameter_nolock(server, name, out, size);
|
||||
spinlock_release(&server->lock);
|
||||
return len;
|
||||
}
|
||||
|
@ -35,7 +35,8 @@ using std::string;
|
||||
namespace
|
||||
{
|
||||
|
||||
const char LOGNAME[] = "/tmp/maxscale.log";
|
||||
const char LOGNAME[] = "maxscale.log";
|
||||
static string logfile;
|
||||
const size_t N_THREADS = 4;
|
||||
|
||||
sem_t u_semstart;
|
||||
@ -110,7 +111,7 @@ bool run(const MXS_LOG_THROTTLING& throttling, int priority, size_t n_generate,
|
||||
mxs_log_set_throttling(&throttling); // Causes message to be logged.
|
||||
mxs_log_flush_sync();
|
||||
|
||||
ifstream in(LOGNAME);
|
||||
ifstream in(logfile);
|
||||
in.seekg(0, ios_base::end);
|
||||
|
||||
THREAD_ARG args[N_THREADS];
|
||||
@ -167,9 +168,13 @@ int main(int argc, char* argv[])
|
||||
rc = sem_init(&u_semfinish, 0, 0);
|
||||
ensure(rc == 0);
|
||||
|
||||
unlink(LOGNAME);
|
||||
|
||||
if (mxs_log_init(NULL, "/tmp", MXS_LOG_TARGET_FS))
|
||||
char tmpbuf[] = "/tmp/maxscale_test_logthrottling_XXXXXX";
|
||||
char* logdir = mkdtemp(tmpbuf);
|
||||
ensure(logdir);
|
||||
logfile.assign(string{logdir} + '/' + LOGNAME);
|
||||
|
||||
if (mxs_log_init(NULL, logdir, MXS_LOG_TARGET_FS))
|
||||
{
|
||||
MXS_LOG_THROTTLING t;
|
||||
|
||||
@ -266,5 +271,10 @@ int main(int argc, char* argv[])
|
||||
rc = EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// A crude method to remove all files but it works
|
||||
string cmd = "rm -r ";
|
||||
cmd += logdir;
|
||||
system(cmd.c_str());
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@ -651,6 +651,11 @@ int mysql_auth_reauthenticate(DCB *dcb, const char *user,
|
||||
MYSQL_AUTH *instance = (MYSQL_AUTH*)dcb->listener->auth_instance;
|
||||
int rc = validate_mysql_user(instance, dcb, &temp, scramble, scramble_len);
|
||||
|
||||
if (rc != MXS_AUTH_SUCCEEDED && service_refresh_users(dcb->service) == 0)
|
||||
{
|
||||
rc = validate_mysql_user(instance, dcb, &temp, scramble, scramble_len);
|
||||
}
|
||||
|
||||
if (rc == MXS_AUTH_SUCCEEDED)
|
||||
{
|
||||
memcpy(output_token, temp.client_sha1, output_token_len);
|
||||
|
@ -731,7 +731,7 @@ static MXS_MONITORED_SERVER *get_candidate_master(MXS_MONITOR* mon)
|
||||
|
||||
moitor_servers->server->depth = 0;
|
||||
char buf[50]; // Enough to hold most numbers
|
||||
if (handle->use_priority && server_get_parameter(moitor_servers->server, "priority", buf, sizeof(buf)))
|
||||
if (handle->use_priority && server_get_parameter_nolock(moitor_servers->server, "priority", buf, sizeof(buf)))
|
||||
{
|
||||
/** The server has a priority */
|
||||
if ((currval = atoi(buf)) > 0)
|
||||
@ -745,11 +745,9 @@ static MXS_MONITORED_SERVER *get_candidate_master(MXS_MONITOR* mon)
|
||||
}
|
||||
}
|
||||
else if (moitor_servers->server->node_id >= 0 &&
|
||||
(!handle->use_priority || /** Server priority disabled*/
|
||||
candidate_master == NULL || /** No candidate chosen */
|
||||
/** Candidate has no priority */
|
||||
!server_get_parameter(moitor_servers->server, "priority", buf, sizeof(buf))))
|
||||
(!handle->use_priority || candidate_master == NULL))
|
||||
{
|
||||
// Server priorities are not in use or no candidate has been found
|
||||
if (min_id < 0 || moitor_servers->server->node_id < min_id)
|
||||
{
|
||||
min_id = moitor_servers->server->node_id;
|
||||
@ -884,7 +882,7 @@ static void update_sst_donor_nodes(MXS_MONITOR *mon, int is_cluster)
|
||||
*/
|
||||
|
||||
if (handle->use_priority &&
|
||||
server_get_parameter(ptr->server, "priority", NULL, 0))
|
||||
server_get_parameter_nolock(ptr->server, "priority", NULL, 0))
|
||||
{
|
||||
ignore_priority = false;
|
||||
}
|
||||
@ -1019,8 +1017,8 @@ static int compare_node_priority (const void *a, const void *b)
|
||||
const MXS_MONITORED_SERVER *s_b = *(MXS_MONITORED_SERVER * const *)b;
|
||||
char pri_a[50];
|
||||
char pri_b[50];
|
||||
bool have_a = server_get_parameter(s_a->server, "priority", pri_a, sizeof(pri_a));
|
||||
bool have_b = server_get_parameter(s_b->server, "priority", pri_b, sizeof(pri_b));
|
||||
bool have_a = server_get_parameter_nolock(s_a->server, "priority", pri_a, sizeof(pri_a));
|
||||
bool have_b = server_get_parameter_nolock(s_b->server, "priority", pri_b, sizeof(pri_b));
|
||||
|
||||
/**
|
||||
* Check priority parameter:
|
||||
|
@ -885,6 +885,14 @@ gw_read_and_write(DCB *dcb)
|
||||
}
|
||||
else
|
||||
{
|
||||
/**
|
||||
* The client protocol always requests an authentication method
|
||||
* switch to the same plugin to be compatible with most connectors.
|
||||
*
|
||||
* To prevent packet sequence number mismatch, always return a sequence
|
||||
* of 3 for the final response to a COM_CHANGE_USER.
|
||||
*/
|
||||
GWBUF_DATA(read_buffer)[3] = 0x3;
|
||||
proto->changing_user = false;
|
||||
}
|
||||
}
|
||||
|
@ -594,24 +594,30 @@ static void store_client_information(DCB *dcb, GWBUF *buffer)
|
||||
const char* username = (const char*)data + MYSQL_AUTH_PACKET_BASE_SIZE;
|
||||
int userlen = get_zstr_len(username, len - MYSQL_AUTH_PACKET_BASE_SIZE);
|
||||
|
||||
if (userlen != -1 && (int)sizeof(ses->user) > userlen)
|
||||
if (userlen != -1)
|
||||
{
|
||||
strcpy(ses->user, username);
|
||||
}
|
||||
|
||||
if (proto->client_capabilities & GW_MYSQL_CAPABILITIES_CONNECT_WITH_DB)
|
||||
{
|
||||
/** Client is connecting with a default database */
|
||||
uint8_t authlen = data[MYSQL_AUTH_PACKET_BASE_SIZE + userlen];
|
||||
size_t dboffset = MYSQL_AUTH_PACKET_BASE_SIZE + userlen + authlen + 1;
|
||||
|
||||
if (dboffset < len)
|
||||
if ((int)sizeof(ses->user) > userlen)
|
||||
{
|
||||
int dblen = get_zstr_len((const char*)data + dboffset, len - dboffset);
|
||||
strcpy(ses->user, username);
|
||||
}
|
||||
|
||||
if (dblen != -1 && (int)sizeof(ses->db) < dblen)
|
||||
// Include the null terminator in the user length
|
||||
userlen++;
|
||||
|
||||
if (proto->client_capabilities & GW_MYSQL_CAPABILITIES_CONNECT_WITH_DB)
|
||||
{
|
||||
/** Client is connecting with a default database */
|
||||
uint8_t authlen = data[MYSQL_AUTH_PACKET_BASE_SIZE + userlen];
|
||||
size_t dboffset = MYSQL_AUTH_PACKET_BASE_SIZE + userlen + authlen + 1;
|
||||
|
||||
if (dboffset < len)
|
||||
{
|
||||
strcpy(ses->db, (const char*)data + dboffset);
|
||||
int dblen = get_zstr_len((const char*)data + dboffset, len - dboffset);
|
||||
|
||||
if (dblen != -1 && (int)sizeof(ses->db) > dblen)
|
||||
{
|
||||
strcpy(ses->db, (const char*)data + dboffset);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1569,19 +1575,35 @@ static bool reauthenticate_client(MXS_SESSION* session, GWBUF* packetbuf)
|
||||
if (session->client_dcb->authfunc.reauthenticate)
|
||||
{
|
||||
MySQLProtocol* proto = (MySQLProtocol*)session->client_dcb->protocol;
|
||||
MYSQL_session* data = (MYSQL_session*)session->client_dcb->data;
|
||||
uint8_t client_sha1[MYSQL_SCRAMBLE_LEN] = {};
|
||||
uint8_t payload[gwbuf_length(packetbuf) - MYSQL_HEADER_LEN];
|
||||
gwbuf_copy_data(packetbuf, MYSQL_HEADER_LEN, sizeof(payload), payload);
|
||||
|
||||
// Will contains extra data but the username is null-terminated
|
||||
char user[gwbuf_length(proto->stored_query) - MYSQL_HEADER_LEN - 1];
|
||||
gwbuf_copy_data(proto->stored_query, MYSQL_HEADER_LEN + 1,
|
||||
sizeof(user), (uint8_t*)user);
|
||||
|
||||
// Copy the new username to the session data
|
||||
MYSQL_session* data = (MYSQL_session*)session->client_dcb->data;
|
||||
strcpy(data->user, user);
|
||||
|
||||
int rc = session->client_dcb->authfunc.reauthenticate(session->client_dcb, data->user,
|
||||
payload, sizeof(payload),
|
||||
proto->scramble, sizeof(proto->scramble),
|
||||
client_sha1, sizeof(client_sha1));
|
||||
data->client_sha1, sizeof(data->client_sha1));
|
||||
|
||||
if (!(rval = rc == MXS_AUTH_SUCCEEDED))
|
||||
if (rc == MXS_AUTH_SUCCEEDED)
|
||||
{
|
||||
// Re-authentication successful, route the original COM_CHANGE_USER
|
||||
rval = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
/**
|
||||
* Authentication failed. To prevent the COM_CHANGE_USER from reaching
|
||||
* the backend servers (and possibly causing problems) the client
|
||||
* connection will be closed.
|
||||
*
|
||||
* First packet is COM_CHANGE_USER, the second is AuthSwitchRequest,
|
||||
* third is the response and the fourth is the following error.
|
||||
*/
|
||||
@ -1712,14 +1734,34 @@ static int route_by_statement(MXS_SESSION* session, uint64_t capabilities, GWBUF
|
||||
{
|
||||
changed_user = true;
|
||||
send_auth_switch_request_packet(session->client_dcb);
|
||||
|
||||
// Store the original COM_CHANGE_USER for later
|
||||
proto->stored_query = packetbuf;
|
||||
packetbuf = NULL;
|
||||
}
|
||||
else if (proto->changing_user)
|
||||
{
|
||||
proto->changing_user = false;
|
||||
bool ok = reauthenticate_client(session, packetbuf);
|
||||
gwbuf_free(packetbuf);
|
||||
packetbuf = proto->stored_query;
|
||||
proto->stored_query = NULL;
|
||||
|
||||
if (ok)
|
||||
{
|
||||
// Authentication was successful, route the original COM_CHANGE_USER
|
||||
rc = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Authentication failed, close the connection
|
||||
rc = 0;
|
||||
gwbuf_free(packetbuf);
|
||||
packetbuf = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (proto->changing_user)
|
||||
{
|
||||
rc = reauthenticate_client(session, packetbuf) ? 1 : 0;
|
||||
gwbuf_free(packetbuf);
|
||||
}
|
||||
else
|
||||
if (packetbuf)
|
||||
{
|
||||
/** Route query */
|
||||
rc = MXS_SESSION_ROUTE_QUERY(session, packetbuf);
|
||||
|
Loading…
x
Reference in New Issue
Block a user