mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-26713 Add test for mysql_install_db creating service, with i18
This commit is contained in:
committed by
Sergei Golubchik
parent
57d52657a2
commit
74f2e6c85e
3
mysql-test/include/check_windows_admin.inc
Normal file
3
mysql-test/include/check_windows_admin.inc
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Check if current user is Windows admin
|
||||||
|
# Used for testing services with mysql_install_db.exe
|
||||||
|
# Actual value is set by suite.pm
|
75
mysql-test/main/winservice.inc
Normal file
75
mysql-test/main/winservice.inc
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
source include/check_windows_admin.inc;
|
||||||
|
|
||||||
|
# The test uses return code from sc.exe utility, which are as follows
|
||||||
|
let $ERROR_SERVICE_DOES_NOT_EXIST= 1060;
|
||||||
|
let $ERROR_SERVICE_CANNOT_ACCEPT_CTRL=1061;# intermediate, during start or stop
|
||||||
|
let $ERROR_SERVICE_NOT_ACTIVE=1062;# service stopped
|
||||||
|
|
||||||
|
let $sc_exe= C:\Windows\System32\sc.exe;
|
||||||
|
let $ddir= $MYSQLTEST_VARDIR/tmp/$datadir_name;
|
||||||
|
let $service_name=$service_name_prefix$MASTER_MYPORT;
|
||||||
|
|
||||||
|
|
||||||
|
error 0,1;
|
||||||
|
rmdir $ddir;
|
||||||
|
|
||||||
|
--disable_result_log
|
||||||
|
error 0,$ERROR_SERVICE_DOES_NOT_EXIST;
|
||||||
|
exec $sc_exe delete $service_name;
|
||||||
|
--enable_result_log
|
||||||
|
|
||||||
|
source include/kill_mysqld.inc;
|
||||||
|
echo # run mysql_install_db with --service parameter;
|
||||||
|
--disable_result_log
|
||||||
|
exec $MYSQL_INSTALL_DB_EXE --datadir=$ddir --port=$MASTER_MYPORT --password=$password --service=$service_name -R;
|
||||||
|
--enable_result_log
|
||||||
|
|
||||||
|
echo # Start service;
|
||||||
|
--disable_result_log
|
||||||
|
exec $sc_exe start $service_name;
|
||||||
|
--enable_result_log
|
||||||
|
|
||||||
|
enable_reconnect;
|
||||||
|
source include/wait_until_connected_again.inc;
|
||||||
|
disable_reconnect;
|
||||||
|
|
||||||
|
echo # Connect with root user password=$password;
|
||||||
|
connect (con1,localhost,root,$password,mysql);
|
||||||
|
|
||||||
|
# Smoke test - check that we're actually using datadir
|
||||||
|
# we've created (i.e restart_parameters worked)
|
||||||
|
replace_result $ddir DATADIR;
|
||||||
|
select @@datadir;
|
||||||
|
|
||||||
|
echo # Stop service and wait until it is down;
|
||||||
|
|
||||||
|
# stop service
|
||||||
|
--disable_result_log
|
||||||
|
exec $sc_exe stop $service_name;
|
||||||
|
# Wait until stopped
|
||||||
|
let $sys_errno=0;
|
||||||
|
while($sys_errno != $ERROR_SERVICE_NOT_ACTIVE)
|
||||||
|
{
|
||||||
|
--error 0,$ERROR_SERVICE_CANNOT_ACCEPT_CTRL,$ERROR_SERVICE_NOT_ACTIVE
|
||||||
|
exec $sc_exe stop $service_name;
|
||||||
|
if($sys_errno != $ERROR_SERVICE_NOT_ACTIVE)
|
||||||
|
{
|
||||||
|
--real_sleep 0.1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
--enable_result_log
|
||||||
|
|
||||||
|
echo # Delete service;
|
||||||
|
let $sys_errno=0;
|
||||||
|
--disable_result_log
|
||||||
|
exec $sc_exe delete $service_name;
|
||||||
|
--enable_result_log
|
||||||
|
|
||||||
|
# Cleanup
|
||||||
|
source include/wait_until_disconnected.inc;
|
||||||
|
rmdir $ddir;
|
||||||
|
|
||||||
|
#restart original server
|
||||||
|
connection default;
|
||||||
|
source include/start_mysqld.inc;
|
||||||
|
|
12
mysql-test/main/winservice_basic.result
Normal file
12
mysql-test/main/winservice_basic.result
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# Kill the server
|
||||||
|
# run mysql_install_db with --service parameter
|
||||||
|
# Start service
|
||||||
|
# Connect with root user password=password
|
||||||
|
connect con1,localhost,root,$password,mysql;
|
||||||
|
select @@datadir;
|
||||||
|
@@datadir
|
||||||
|
DATADIR/
|
||||||
|
# Stop service and wait until it is down
|
||||||
|
# Delete service
|
||||||
|
connection default;
|
||||||
|
# restart
|
5
mysql-test/main/winservice_basic.test
Normal file
5
mysql-test/main/winservice_basic.test
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
source include/windows.inc;
|
||||||
|
let $datadir_name=data;
|
||||||
|
let $service_name_prefix=mariadb;
|
||||||
|
let $password=password;
|
||||||
|
source winservice.inc;
|
12
mysql-test/main/winservice_i18n.result
Normal file
12
mysql-test/main/winservice_i18n.result
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# Kill the server
|
||||||
|
# run mysql_install_db with --service parameter
|
||||||
|
# Start service
|
||||||
|
# Connect with root user password=パスワード
|
||||||
|
connect con1,localhost,root,$password,mysql;
|
||||||
|
select @@datadir;
|
||||||
|
@@datadir
|
||||||
|
DATADIR/
|
||||||
|
# Stop service and wait until it is down
|
||||||
|
# Delete service
|
||||||
|
connection default;
|
||||||
|
# restart
|
7
mysql-test/main/winservice_i18n.test
Normal file
7
mysql-test/main/winservice_i18n.test
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
source include/windows.inc;
|
||||||
|
source include/check_utf8_cli.inc;
|
||||||
|
|
||||||
|
let $datadir_name=датадир;
|
||||||
|
let $service_name_prefix=mariadb_sörvis;
|
||||||
|
let $password=パスワード;
|
||||||
|
source winservice.inc;
|
@ -109,6 +109,9 @@ sub skip_combinations {
|
|||||||
|
|
||||||
$skip{'include/no_utf8_cli.inc'} = 'Not tested with utf8 command line support'
|
$skip{'include/no_utf8_cli.inc'} = 'Not tested with utf8 command line support'
|
||||||
unless !utf8_command_line_ok();
|
unless !utf8_command_line_ok();
|
||||||
|
|
||||||
|
$skip{'include/check_windows_admin.inc'} = 'Requires admin privileges'
|
||||||
|
unless IS_WINDOWS and Win32::IsAdminUser();
|
||||||
|
|
||||||
%skip;
|
%skip;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user