Skip to content

Commit 36a66e0

Browse files
author
Shlomi Noach
committed
supporting customized 'order by' in tests
1 parent 8d8ef34 commit 36a66e0

4 files changed

Lines changed: 31 additions & 3 deletions

File tree

localtests/fail-drop-pk/create.sql

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
drop table if exists gh_ost_test;
2+
create table gh_ost_test (
3+
id int auto_increment,
4+
i int not null,
5+
ts timestamp,
6+
primary key(id)
7+
) auto_increment=1;
8+
9+
drop event if exists gh_ost_test;
10+
delimiter ;;
11+
create event gh_ost_test
12+
on schedule every 1 second
13+
starts current_timestamp
14+
ends current_timestamp + interval 60 second
15+
on completion not preserve
16+
enable
17+
do
18+
begin
19+
insert into gh_ost_test values (null, 11, now());
20+
insert into gh_ost_test values (null, 13, now());
21+
insert into gh_ost_test values (null, 17, now());
22+
end ;;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
No PRIMARY nor UNIQUE key found in table

localtests/fail-drop-pk/extra_args

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--alter="change id id int, drop primary key"

localtests/test.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ test_single() {
4949
echo -n "Testing: $test_name"
5050

5151
echo_dot
52-
gh-ost-test-mysql-replica -e "start slave"
52+
gh-ost-test-mysql-replica -e "stop slave; start slave; do sleep(1)"
5353
echo_dot
5454
gh-ost-test-mysql-master --default-character-set=utf8mb4 test < $tests_path/$test_name/create.sql
5555

@@ -59,12 +59,16 @@ test_single() {
5959
fi
6060
orig_columns="*"
6161
ghost_columns="*"
62+
order_by=""
6263
if [ -f $tests_path/$test_name/orig_columns ] ; then
6364
orig_columns=$(cat $tests_path/$test_name/orig_columns)
6465
fi
6566
if [ -f $tests_path/$test_name/ghost_columns ] ; then
6667
ghost_columns=$(cat $tests_path/$test_name/ghost_columns)
6768
fi
69+
if [ -f $tests_path/$test_name/order_by ] ; then
70+
order_by="order by $(cat $tests_path/$test_name/order_by)"
71+
fi
6872
# graceful sleep for replica to catch up
6973
echo_dot
7074
sleep 1
@@ -129,8 +133,8 @@ test_single() {
129133
fi
130134

131135
echo_dot
132-
orig_checksum=$(gh-ost-test-mysql-replica --default-character-set=utf8mb4 test -e "select ${orig_columns} from gh_ost_test" -ss | md5sum)
133-
ghost_checksum=$(gh-ost-test-mysql-replica --default-character-set=utf8mb4 test -e "select ${ghost_columns} from _gh_ost_test_gho" -ss | md5sum)
136+
orig_checksum=$(gh-ost-test-mysql-replica --default-character-set=utf8mb4 test -e "select ${orig_columns} from gh_ost_test ${order_by}" -ss | md5sum)
137+
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)
134138

135139
if [ "$orig_checksum" != "$ghost_checksum" ] ; then
136140
echo "ERROR $test_name: checksum mismatch"

0 commit comments

Comments
 (0)