Skip to content

Commit

Permalink
Merge pull request #651 from github/test-throttle-file
Browse files Browse the repository at this point in the history
localtests support throttle flag file
  • Loading branch information
Shlomi Noach authored Oct 16, 2018
2 parents 9f81a23 + 0260230 commit 0c37a6d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions localtests/datetime-1970/create.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
set session time_zone='+00:00';

drop table if exists gh_ost_test;
create table gh_ost_test (
id int auto_increment,
Expand All @@ -7,6 +9,7 @@ create table gh_ost_test (
primary key(id)
) auto_increment=1;

set session time_zone='+00:00';
insert into gh_ost_test values (1, '0000-00-00 00:00:00', now(), 0);

drop event if exists gh_ost_test;
Expand All @@ -19,5 +22,6 @@ create event gh_ost_test
enable
do
begin
set session time_zone='+00:00';
update gh_ost_test set counter = counter + 1 where id = 1;
end ;;
8 changes: 6 additions & 2 deletions localtests/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ ghost_binary=""
exec_command_file=/tmp/gh-ost-test.bash
orig_content_output_file=/tmp/gh-ost-test.orig.content.csv
ghost_content_output_file=/tmp/gh-ost-test.ghost.content.csv
throttle_flag_file=/tmp/gh-ost-test.ghost.throttle.flag

master_host=
master_port=
replica_host=
replica_port=
original_sql_mode=

OPTIND=1
while getopts "b:" OPTION
Expand All @@ -45,6 +47,8 @@ verify_master_and_replica() {
echo "Cannot enable event_scheduler on master"
exit 1
fi
original_sql_mode="$(gh-ost-test-mysql-master -e "select @@global.sql_mode" -s -s)"
echo "sql_mode on master is ${original_sql_mode}"

if [ "$(gh-ost-test-mysql-replica -e "select 1" -ss)" != "1" ] ; then
echo "Cannot verify gh-ost-test-mysql-replica"
Expand Down Expand Up @@ -87,7 +91,6 @@ start_replication() {
test_single() {
local test_name
test_name="$1"
original_sql_mode="$(gh-ost-test-mysql-master -e "select @@global.sql_mode" -s -s)"

if [ -f $tests_path/$test_name/ignore_versions ] ; then
ignore_versions=$(cat $tests_path/$test_name/ignore_versions)
Expand All @@ -108,7 +111,7 @@ test_single() {
gh-ost-test-mysql-master --default-character-set=utf8mb4 test -e "set @@global.sql_mode='$(cat $tests_path/$test_name/sql_mode)'"
gh-ost-test-mysql-replica --default-character-set=utf8mb4 test -e "set @@global.sql_mode='$(cat $tests_path/$test_name/sql_mode)'"
fi

gh-ost-test-mysql-master --default-character-set=utf8mb4 test < $tests_path/$test_name/create.sql

extra_args=""
Expand Down Expand Up @@ -145,6 +148,7 @@ test_single() {
--initially-drop-old-table \
--initially-drop-ghost-table \
--throttle-query='select timestampdiff(second, min(last_update), now()) < 5 from _gh_ost_test_ghc' \
--throttle-flag-file=$throttle_flag_file \
--serve-socket-file=/tmp/gh-ost.test.sock \
--initially-drop-socket-file \
--test-on-replica \
Expand Down

0 comments on commit 0c37a6d

Please sign in to comment.