From 36a66e0c05c8bb2cd27efccfce5ab6ad66be0f7a Mon Sep 17 00:00:00 2001 From: Shlomi Noach Date: Tue, 10 Jan 2017 12:35:10 +0200 Subject: [PATCH] supporting customized 'order by' in tests --- localtests/fail-drop-pk/create.sql | 22 ++++++++++++++++++++++ localtests/fail-drop-pk/expect_failure | 1 + localtests/fail-drop-pk/extra_args | 1 + localtests/test.sh | 10 +++++++--- 4 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 localtests/fail-drop-pk/create.sql create mode 100644 localtests/fail-drop-pk/expect_failure create mode 100644 localtests/fail-drop-pk/extra_args diff --git a/localtests/fail-drop-pk/create.sql b/localtests/fail-drop-pk/create.sql new file mode 100644 index 0000000..5bb45f2 --- /dev/null +++ b/localtests/fail-drop-pk/create.sql @@ -0,0 +1,22 @@ +drop table if exists gh_ost_test; +create table gh_ost_test ( + id int auto_increment, + i int not null, + ts timestamp, + primary key(id) +) auto_increment=1; + +drop event if exists gh_ost_test; +delimiter ;; +create event gh_ost_test + on schedule every 1 second + starts current_timestamp + ends current_timestamp + interval 60 second + on completion not preserve + enable + do +begin + insert into gh_ost_test values (null, 11, now()); + insert into gh_ost_test values (null, 13, now()); + insert into gh_ost_test values (null, 17, now()); +end ;; diff --git a/localtests/fail-drop-pk/expect_failure b/localtests/fail-drop-pk/expect_failure new file mode 100644 index 0000000..021ae87 --- /dev/null +++ b/localtests/fail-drop-pk/expect_failure @@ -0,0 +1 @@ +No PRIMARY nor UNIQUE key found in table diff --git a/localtests/fail-drop-pk/extra_args b/localtests/fail-drop-pk/extra_args new file mode 100644 index 0000000..2017cbc --- /dev/null +++ b/localtests/fail-drop-pk/extra_args @@ -0,0 +1 @@ +--alter="change id id int, drop primary key" diff --git a/localtests/test.sh b/localtests/test.sh index ab7b459..c0b97a5 100755 --- a/localtests/test.sh +++ b/localtests/test.sh @@ -49,7 +49,7 @@ test_single() { echo -n "Testing: $test_name" echo_dot - gh-ost-test-mysql-replica -e "start slave" + gh-ost-test-mysql-replica -e "stop slave; start slave; do sleep(1)" echo_dot gh-ost-test-mysql-master --default-character-set=utf8mb4 test < $tests_path/$test_name/create.sql @@ -59,12 +59,16 @@ test_single() { fi orig_columns="*" ghost_columns="*" + order_by="" if [ -f $tests_path/$test_name/orig_columns ] ; then orig_columns=$(cat $tests_path/$test_name/orig_columns) fi if [ -f $tests_path/$test_name/ghost_columns ] ; then ghost_columns=$(cat $tests_path/$test_name/ghost_columns) fi + if [ -f $tests_path/$test_name/order_by ] ; then + order_by="order by $(cat $tests_path/$test_name/order_by)" + fi # graceful sleep for replica to catch up echo_dot sleep 1 @@ -129,8 +133,8 @@ test_single() { fi echo_dot - orig_checksum=$(gh-ost-test-mysql-replica --default-character-set=utf8mb4 test -e "select ${orig_columns} from gh_ost_test" -ss | md5sum) - ghost_checksum=$(gh-ost-test-mysql-replica --default-character-set=utf8mb4 test -e "select ${ghost_columns} from _gh_ost_test_gho" -ss | md5sum) + orig_checksum=$(gh-ost-test-mysql-replica --default-character-set=utf8mb4 test -e "select ${orig_columns} from gh_ost_test ${order_by}" -ss | md5sum) + ghost_checksum=$(gh-ost-test-mysql-replica --default-character-set=utf8mb4 test -e "select ${ghost_columns} from _gh_ost_test_gho ${order_by}" -ss | md5sum) if [ "$orig_checksum" != "$ghost_checksum" ] ; then echo "ERROR $test_name: checksum mismatch"