用于EagleEye3.0 规则集漏报和误报测试的示例项目,项目收集于github和gitee
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

80 lines
2.6 KiB

# ==== Purpose ====
#
# This test will initialize a new instance of a mysql server enabling binary
# logging and GTID features. After the server initialization, the test case
# will connect to the new server and no GTIDs are expected to be generated
# during the initialization (GTID_EXECUTED should be empty) except from the
# statements in the initialization file.
#
# ==== Related Bugs and Worklogs ====
#
# Bug#22102456 ENABLING GTID AT STARTUP RESULTS IN UNNECESSARY GTID SETS
#
--let BASEDIR= `select @@basedir`
--let DDIR=$MYSQL_TMP_DIR/installdb_test
--let MYSQLD_LOG=$MYSQL_TMP_DIR/server.log
--let extra_args=--no-defaults --innodb_dedicated_server=OFF --console --loose-skip-auto_generate_certs --loose-skip-sha256_password_auto_generate_rsa_keys --skip-ssl --basedir=$BASEDIR --lc-messages-dir=$MYSQL_SHAREDIR
--let init_args=--explicit_defaults_for_timestamp --gtid-mode=on --enforce-gtid-consistency=on --log-bin=mysql-bin --server-id=1
--let BOOTSTRAP_SQL=$MYSQL_TMP_DIR/tiny_bootstrap.sql
# We don't care about innodb warnings at this point
USE mysql;
--echo # Create bootstrap file
write_file $BOOTSTRAP_SQL;
CREATE DATABASE test;
CREATE TABLE test.t1(a INT) ENGINE=innodb;
BEGIN;
INSERT INTO test.t1 VALUES (1);
COMMIT;
SET sql_log_bin= 0;
BEGIN;
INSERT INTO test.t1 VALUES (2);
COMMIT;
SET sql_log_bin= 1;
DROP TABLE test.t1;
DROP DATABASE test;
EOF
--echo # Shut server down
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
--echo # Server is down
--echo # Run the server with:
--echo # --initialize-insecure
--echo # $init_args
--exec $MYSQLD $extra_args --initialize-insecure --datadir=$DDIR $init_args --init-file=$BOOTSTRAP_SQL > $MYSQLD_LOG 2>&1
--echo # Restart the server against DDIR
--exec echo "restart:--datadir=$DDIR $init_args" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
--echo # Connect as root
connect(root_con,localhost,root,,mysql);
--let $master_uuid= `SELECT @@GLOBAL.SERVER_UUID`
--let $assert_text= GTID_EXECUTED should have only the 5 GTIDs from the init-file
--let $assert_cond= @@GLOBAL.GTID_EXECUTED = "$master_uuid:1-5"
--source include/assert.inc
--echo # Clean up
# Shut server down
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
# Delete mysqld log and init file
remove_file $MYSQLD_LOG;
# Delete datadir
--force-rmdir $DDIR
remove_file $BOOTSTRAP_SQL;
--echo # Restarting the server after cleaning it up
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc