Commit 9ff59511 authored by monty@donna.mysql.com's avatar monty@donna.mysql.com

Cleanup of tests to make them less dependent of eachother

Added new big select test
parent ac0ceaf2
Table Op Msg_type Msg_text
test.words check status OK
test.t1 check status OK
This diff is collapsed.
......@@ -34,3 +34,12 @@ Table Op Msg_type Msg_text
test.t1 optimize status OK
Table Op Msg_type Msg_text
test.t1 optimize status Table is already up to date
Variable_name Value
wait_timeout 28800
Variable_name Value
Name Type Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Create_options Comment
Database
mysql
test
Database (test%)
test
Table Create Table
test CREATE TABLE `test` (
t1 CREATE TABLE `t1` (
`test_set` set('val1','val2','val3') NOT NULL default '',
`name` char(20) default 'O''Brien'
) TYPE=MyISAM COMMENT='it''s a table'
# several FULLTEXT indexes in one table test
use test;
DROP TABLE IF EXISTS test;
CREATE TABLE test (
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
a int(11) NOT NULL auto_increment,
b text,
c varchar(254) default NULL,
......@@ -11,10 +11,11 @@ CREATE TABLE test (
FULLTEXT KEY a(b,c)
);
INSERT INTO test VALUES (1,'lala lolo lili','oooo aaaa pppp');
INSERT INTO test VALUES (2,'asdf fdsa','lkjh fghj');
INSERT INTO test VALUES (3,'qpwoei','zmxnvb');
INSERT INTO t1 VALUES (1,'lala lolo lili','oooo aaaa pppp');
INSERT INTO t1 VALUES (2,'asdf fdsa','lkjh fghj');
INSERT INTO t1 VALUES (3,'qpwoei','zmxnvb');
SELECT a, MATCH b AGAINST ('lala lkjh') FROM test;
SELECT a, MATCH c AGAINST ('lala lkjh') FROM test;
SELECT a, MATCH b,c AGAINST ('lala lkjh') FROM test;
SELECT a, MATCH b AGAINST ('lala lkjh') FROM t1;
SELECT a, MATCH c AGAINST ('lala lkjh') FROM t1;
SELECT a, MATCH b,c AGAINST ('lala lkjh') FROM t1;
drop table t1;
use test;
DROP TABLE IF EXISTS test;
CREATE TABLE test (
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
a INT AUTO_INCREMENT PRIMARY KEY,
message CHAR(20),
FULLTEXT(message)
) comment = 'original testcase by sroussey@network54.com';
INSERT INTO test (message) VALUES ("Testing"),("table"),("testbug"),
INSERT INTO t1 (message) VALUES ("Testing"),("table"),("testbug"),
("steve"),("is"),("cool"),("steve is cool");
# basic MATCH
SELECT a, MATCH (message) AGAINST ('steve') FROM test WHERE MATCH (message) AGAINST ('steve');
SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE MATCH (message) AGAINST ('steve');
# MATCH + ORDER BY (with ft-ranges)
SELECT a, MATCH (message) AGAINST ('steve') FROM test WHERE MATCH (message) AGAINST ('steve') ORDER BY a;
SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY a;
# MATCH + ORDER BY (with normal ranges) + UNIQUE
SELECT a, MATCH (message) AGAINST ('steve') FROM test WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve') ORDER BY a DESC;
SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve') ORDER BY a DESC;
# MATCH + ORDER BY + UNIQUE (const_table)
SELECT a, MATCH (message) AGAINST ('steve') FROM test WHERE a=7 and MATCH (message) AGAINST ('steve') ORDER BY 1;
SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve') ORDER BY 1;
# ORDER BY MATCH
SELECT a, MATCH (message) AGAINST ('steve') as rel FROM test ORDER BY rel;
SELECT a, MATCH (message) AGAINST ('steve') as rel FROM t1 ORDER BY rel;
drop table t1;
source include/master-slave.inc;
connection master;
use test;
drop table if exists words;
create table words (word char(20) not null);
load data infile '../../std_data/words.dat' into table words;
drop table if exists t1;
create table t1 (word char(20) not null);
load data infile '../../std_data/words.dat' into table t1;
drop table if exists foo;
create table foo(n int);
insert into foo values(1),(2);
......@@ -11,5 +11,8 @@ connection slave;
sleep 2;
use test;
@r/rpl000001.a.result select * from foo;
@r/rpl000001.b.result select sum(length(word)) from words;
@r/rpl000001.b.result select sum(length(word)) from t1;
connection master;
drop table t1;
source include/master-slave.inc;
connection master;
use test;
drop table if exists x;
create table x(n int auto_increment primary key);
drop table if exists t1;
create table t1 (n int auto_increment primary key);
set insert_id = 2000;
insert into x values (NULL),(NULL),(NULL);
insert into t1 values (NULL),(NULL),(NULL);
connection slave;
use test;
sleep 0.5;
@r/rpl000002.result select * from x;
sleep 2;
@r/rpl000002.result select * from t1;
drop table t1;
source include/master-slave.inc;
connection master;
drop table if exists x;
create table x(n int primary key);
!insert into x values (1),(2),(2);
insert into x values (3);
drop table if exists t1;
create table t1(n int primary key);
!insert into t1 values (1),(2),(2);
insert into t1 values (3);
connection slave;
sleep 0.5;
@r/rpl000003.result select * from x;
sleep 2;
@r/rpl000003.result select * from t1;
drop table t1;
......@@ -2,17 +2,18 @@ source include/master-slave.inc;
connection master;
use test;
set SQL_LOG_BIN=0;
drop table if exists words;
create table words (word char(20) not null, index(word));
load data infile '../../std_data/words.dat' into table words;
drop table if exists words1;
create table words1 (word char(20) not null);
load data infile '../../std_data/words.dat' into table words1;
drop table if exists t1;
create table t1 (word char(20) not null, index(word));
load data infile '../../std_data/words.dat' into table t1;
drop table if exists t2;
create table t2 (word char(20) not null);
load data infile '../../std_data/words.dat' into table t2;
connection slave;
use test;
drop table if exists words;
load table words from master;
drop table if exists words1;
load table words1 from master;
@r/rpl000004.a.result check table words;
@r/rpl000004.b.result select count(*) from words1;
drop table if exists t1;
load table t1 from master;
drop table if exists t2;
load table t2 from master;
@r/rpl000004.a.result check table t1;
@r/rpl000004.b.result select count(*) from t2;
drop table if exists t1,t2;
source include/master-slave.inc;
connection master;
drop table if exists test;
CREATE TABLE test (name varchar(64), age smallint(3));
INSERT INTO test SET name='Andy', age=31;
INSERT test SET name='Jacob', age=2;
INSERT into test SET name='Caleb', age=1;
ALTER TABLE test ADD id int(8) ZEROFILL AUTO_INCREMENT PRIMARY KEY;
@r/rpl000005.result select * from test;
drop table if exists t1;
CREATE TABLE t1 (name varchar(64), age smallint(3));
INSERT INTO t1 SET name='Andy', age=31;
INSERT t1 SET name='Jacob', age=2;
INSERT into t1 SET name='Caleb', age=1;
ALTER TABLE t1 ADD id int(8) ZEROFILL AUTO_INCREMENT PRIMARY KEY;
@r/rpl000005.result select * from t1;
connection slave;
sleep 0.5;
@r/rpl000005.result select * from test;
sleep 2;
@r/rpl000005.result select * from t1;
connection master;
drop table t1;
......@@ -10,3 +10,5 @@ connection slave;
drop table if exists foo;
load table foo from master;
@r/rpl000006.result select unix_timestamp(t) from foo;
connection master;
drop table foo;
......@@ -16,5 +16,7 @@ drop table if exists bar;
create table bar (m int);
insert into bar values(15);
connection slave;
sleep 1;
sleep 2;
@r/rpl000007.result select foo.n,bar.m from foo,bar;
connection master;
drop table if exists bar,foo;
......@@ -18,5 +18,7 @@ drop table if exists choo;
create table choo (k int);
insert into choo values(55);
connection slave;
sleep 1;
sleep 2;
@r/rpl000008.result select foo.n,bar.m,choo.k from foo,bar,choo;
connection master;
drop table if exists foo,bar,choo;
......@@ -7,7 +7,7 @@ create database foo;
drop database if exists bar;
create database bar;
connection slave;
sleep 1;
sleep 2;
drop table if exists foo.foo;
create table foo.foo (n int);
insert into foo.foo values(4);
......@@ -19,5 +19,8 @@ drop table if exists bar.bar;
create table bar.bar (m int);
insert into bar.bar values(15);
connection slave;
sleep 1;
sleep 2;
@r/rpl000009.result select foo.foo.n,bar.bar.m from foo.foo,bar.bar;
connection master;
drop database if exists bar;
drop database if exists foo;
......@@ -2,12 +2,14 @@
#must run slave with --disconnect-slave-event-count=1 --master-connect-retry=1
source include/master-slave.inc;
connection slave;
drop table if exists foo;
drop table if exists t1;
connection master;
drop table if exists foo;
create table foo (n int not null auto_increment primary key);
insert into foo values(NULL);
insert into foo values(2);
drop table if exists t1;
create table t1 (n int not null auto_increment primary key);
insert into t1 values(NULL);
insert into t1 values(2);
connection slave;
sleep 5;
@r/rpl000010.result select n from foo;
@r/rpl000010.result select n from t1;
connection master;
drop table t1;
source include/master-slave.inc;
connection master;
use test;
drop table if exists foo;
create table foo (n int);
insert into foo values(1);
drop table if exists t1;
create table t1 (n int);
insert into t1 values(1);
connection slave;
#give slave some breathing room to get started
sleep 1;
sleep 2;
slave stop;
slave start;
connection master;
insert into foo values(2);
insert into t1 values(2);
connection slave;
#let slave catch up
sleep 1;
@r/rpl000011.result select * from foo;
sleep 2;
@r/rpl000011.result select * from t1;
connection master;
drop table t1;
source include/master-slave.inc;
connection master;
drop table if exists x;
create table x(n int);
create temporary table t(n int);
insert into t values(1),(2),(3);
insert into x select * from t;
drop table if exists t1,t2;
create table t2 (n int);
create temporary table t1 (n int);
insert into t1 values(1),(2),(3);
insert into t2 select * from t1;
connection master1;
create temporary table t (n int);
insert into t values (4),(5);
insert into x select * from t;
create temporary table t1 (n int);
insert into t1 values (4),(5);
insert into t2 select * from t1;
disconnect master;
connection master1;
insert into x values(6);
insert into t2 values(6);
disconnect master1;
connection slave;
sleep 1;
@r/rpl000012.result select * from x;
@r/rpl000012.result select * from t2;
@r/rpl000012.status.result show status like 'Slave_open_temp_tables';
#
# Clean up
#
connect (master2,localhost,root,,test,0,var/tmp/mysql.sock);
connection master2;
drop table if exists t1,t2;
source include/master-slave.inc;
connection master;
drop table if exists x;
create table x(n int);
create temporary table t(n int);
insert into t values(1),(2),(3);
insert into x select * from t;
drop table if exists t2;
create table t2(n int);
create temporary table t1 (n int);
insert into t1 values(1),(2),(3);
insert into t2 select * from t1;
connection master1;
create temporary table t (n int);
insert into t values (4),(5);
insert into x select * from t;
create temporary table t1 (n int);
insert into t1 values (4),(5);
insert into t2 select * from t1;
disconnect master;
connection master1;
insert into x values(6);
insert into t2 values(6);
sleep 2;
disconnect master1;
connection slave;
let $1=12;
......@@ -21,5 +22,11 @@ while ($1)
sleep 0.2;
dec $1;
}
@r/rpl000013.result select * from x;
@r/rpl000013.result select * from t2;
@r/rpl000013.status.result show status like 'Slave_open_temp_tables';
#
# Clean up
#
connect (master2,localhost,root,,test,0,var/tmp/mysql.sock);
connection master2;
drop table if exists t1,t2;
......@@ -20,5 +20,7 @@ create table foo (n int);
insert into foo values (1),(2),(3);
connection slave;
change master to master_log_pos=73;
sleep 0.2;
sleep 2;
select * from foo;
connection master;
drop table foo;
......@@ -18,7 +18,7 @@ drop table if exists foo;
create table foo (n int);
insert into foo values (10),(45),(90);
connection slave;
sleep 0.3;
sleep 2;
select * from foo;
connection master;
drop table foo;
......@@ -11,23 +11,24 @@ reset slave;
!change master to master_host='127.0.0.1',master_port=9306,master_user='root';
slave start;
connection master;
drop table if exists foo;
create table foo(s text);
insert into foo values('Could not break slave'),('Tried hard');
drop table if exists t1;
create table t1 (s text);
insert into t1 values('Could not break slave'),('Tried hard');
connection slave;
sleep 0.3;
select * from foo;
sleep 2;
select * from t1;
connection master;
flush logs;
drop table if exists bar;
create table bar(m int);
insert into bar values (34),(67),(123);
drop table if exists t2;
create table t2(m int);
insert into t2 values (34),(67),(123);
flush logs;
sleep 0.3;
show master logs;
purge master logs to 'master-bin.003';
show master logs;
insert into bar values (65);
insert into t2 values (65);
connection slave;
sleep 0.3;
select * from bar;
sleep 2;
select * from t2;
drop table if exists t1,t2;
......@@ -11,7 +11,8 @@
# Testing WHERE clause.
#
DROP TABLE IF EXISTS t;
CREATE TABLE t (s CHAR(20) PRIMARY KEY, id INT);
INSERT INTO t VALUES ('cat', 1), ('mouse', 3), ('dog', 2), ('snake', 77);
@r/sel000001.result SELECT s, id FROM t WHERE s = 'mouse';
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (s CHAR(20) PRIMARY KEY, id INT);
INSERT INTO t1 VALUES ('cat', 1), ('mouse', 3), ('dog', 2), ('snake', 77);
@r/sel000001.result SELECT s, id FROM t1 WHERE s = 'mouse';
drop table t1;
......@@ -10,7 +10,8 @@
# This test is just a simple select.
#
DROP TABLE IF EXISTS t;
CREATE TABLE t (n INT);
INSERT INTO t VALUES (1), (2), (3);
@r/sel000002.result SELECT * FROM t;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (n INT);
INSERT INTO t1 VALUES (1), (2), (3);
@r/sel000002.result SELECT * FROM t1;
drop table t1;
......@@ -11,7 +11,8 @@
# Testing count() function and GROUP BY clause.
#
DROP TABLE IF EXISTS t;
CREATE TABLE t (name CHAR(20) NOT NULL PRIMARY KEY, score SMALLINT NOT NULL, KEY(score));
INSERT INTO t VALUES ('Sasha', 20), ('Matt', 20), ('Monty', 10), ('David', 10), ('Tim', 10), ('Jeremy', 10);
@r/sel000003.result SELECT COUNT(*) as n, score FROM t GROUP BY score;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (name CHAR(20) NOT NULL PRIMARY KEY, score SMALLINT NOT NULL, KEY(score));
INSERT INTO t1 VALUES ('Sasha', 20), ('Matt', 20), ('Monty', 10), ('David', 10), ('Tim', 10), ('Jeremy', 10);
@r/sel000003.result SELECT COUNT(*) as n, score FROM t1 GROUP BY score;
drop table t1;
......@@ -9,12 +9,12 @@
# -----------
# test for a bug with elt() and order by
drop table if exists elt_ck1,elt_ck2;
create table elt_ck1 (id int(10) not null unique);
create table elt_ck2 (id int(10) not null primary key,
drop table if exists t1,t2;
create table t1 (id int(10) not null unique);
create table t2 (id int(10) not null primary key,
val int(10) not null);
insert into elt_ck1 values (1),(2),(4);
insert into elt_ck2 values (1,1),(2,1),(3,1),(4,2);
@r/sel000031.result select one.id, elt(two.val,'one','two') from elt_ck1 one, elt_ck2 two where two.id=one.id order by one.id;
insert into t1 values (1),(2),(4);
insert into t2 values (1,1),(2,1),(3,1),(4,2);
@r/sel000031.result select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id order by one.id;
drop table t1,t2;
......@@ -9,11 +9,11 @@
# -----------
# test for a bug with elt()
drop table if exists elt_ck1,elt_ck2;
create table elt_ck1 (id int(10) not null unique);
create table elt_ck2 (id int(10) not null primary key,
drop table if exists t1,t2;
create table t1 (id int(10) not null unique);
create table t2 (id int(10) not null primary key,
val int(10) not null);
insert into elt_ck1 values (1),(2),(4);
insert into elt_ck2 values (1,1),(2,1),(3,1),(4,2);
insert into t1 values (1),(2),(4);
insert into t2 values (1,1),(2,1),(3,1),(4,2);
@r/sel000032.result select one.id, elt(two.val,'one','two') from elt_ck1 one, elt_ck2 two where two.id=one.id;
@r/sel000032.result select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id;
......@@ -9,9 +9,10 @@
# -----------
# test for a bug with in() and unique key
drop table if exists t;
create table t (id int(10) primary key);
insert into t values (1),(2),(3),(4),(5),(6),(7),(8),(9);
drop table if exists t1;
create table t1 (id int(10) primary key);
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9);
@r/sel000033.result select id from t where id in (2,5,9) ;
@r/sel000033.result select id from t where id=2 or id=5 or id=9 ;
@r/sel000033.result select id from t1 where id in (2,5,9) ;
@r/sel000033.result select id from t1 where id=2 or id=5 or id=9 ;
drop table t1;
DROP TABLE IF EXISTS test1;
DROP TABLE IF EXISTS test2;
DROP TABLE IF EXISTS t1,t2;
CREATE TABLE test1 (
CREATE TABLE t1 (
ID int(11) NOT NULL auto_increment,
NAME varchar(75) DEFAULT '' NOT NULL,
LINK_ID int(11) DEFAULT '0' NOT NULL,
......@@ -10,11 +9,11 @@ CREATE TABLE test1 (
KEY LINK_ID (LINK_ID)
);
INSERT INTO test1 (ID, NAME, LINK_ID) VALUES (1,'Mike',0);
INSERT INTO test1 (ID, NAME, LINK_ID) VALUES (2,'Jack',0);
INSERT INTO test1 (ID, NAME, LINK_ID) VALUES (3,'Bill',0);
INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (1,'Mike',0);
INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (2,'Jack',0);
INSERT INTO t1 (ID, NAME, LINK_ID) VALUES (3,'Bill',0);
CREATE TABLE test2 (
CREATE TABLE t2 (
ID int(11) NOT NULL auto_increment,
NAME varchar(150) DEFAULT '' NOT NULL,
PRIMARY KEY (ID),
......@@ -22,9 +21,11 @@ CREATE TABLE test2 (
);
@r/sel000100.result SELECT DISTINCT
test2.id AS key_link_id,
test2.name AS link
FROM test1
LEFT JOIN test2 ON test1.link_id=test2.id
GROUP BY test1.id
t2.id AS key_link_id,
t2.name AS link
FROM t1
LEFT JOIN t2 ON t1.link_id=t2.id
GROUP BY t1.id
ORDER BY link;
drop table t1,t2;
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -26,3 +26,10 @@ show keys from t1;
optimize table t1;
optimize table t1;
drop table t1;
#show variables;
show variables like "wait_timeout%";
show variables like "this_doesn't_exists%";
show table status from test like "this_doesn't_exists%";
show databases;
show databases like "test%";
use test;
drop table if exists test;
create table test (
drop table if exists t1;
create table t1 (
test_set set( 'val1', 'val2', 'val3' ) not null default '',
name char(20) default 'O''Brien'
) comment = 'it\'s a table' ;
@r/shw000001.result show create table test ;
@r/shw000001.result show create table t1 ;
drop table t1;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment