~drizzle-trunk/drizzle/development

1543.1.2 by patrick crews
Incorporated review feedback and deleted unused code from diff_tables.inc. Also fixed omission of the new include, test, and result files
1
###############################################################################
2
# drizzledump_restore.test
3
#
4
# Purpose:  Tests if drizzledump output can be used to successfully restore
5
#           tables and data.  
6
#           We CREATE a table, drizzledump it to a file, ALTER the original
7
#           table's name, recreate the table from the drizzledump file, then
8
#           utilize include/diff_tables to compare the original and recreated
9
#           tables.
10
#
11
#           We use several examples from drizzledump.test here and include
12
#           the relevant bug numbers and headers from that test.
13
#
14
# NOTE:     This test is not currently complete and offers only basic
15
#           cases of drizzledump output being restored. 
16
#           Also, does NOT work with -X (xml) output!
17
#           
18
# Author:   pcrews
19
# Created:  2009-05-21
20
# Last Change:
21
# Change date:
22
###############################################################################
23
24
#--source include/have_log_bin.inc
25
26
27
# Define drizzledumpfile here.  It is used to capture drizzledump output
28
# in order to test the output's ability to restore an exact copy of the table
1819.2.2 by patrick crews
Adjustments to tests to deal with the name changes. Also fixed passed/failed reporting post-run in test-run.pl
29
let $drizzledumpfile = $DRIZZLETEST_VARDIR/tmp/drizzledumpfile.sql;
1543.1.2 by patrick crews
Incorporated review feedback and deleted unused code from diff_tables.inc. Also fixed omission of the new include, test, and result files
30
31
--echo # Pre-test cleanup
32
--disable_warnings
33
DROP TABLE IF EXISTS t1;
34
--enable_warnings
35
36
--echo # Begin tests
37
--echo #
38
--echo # Bug#2005 Long decimal comparison bug.
39
--echo #
40
CREATE TABLE t1 (a DECIMAL(64, 20));
41
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
42
("0987654321098765432109876543210987654321");
43
--exec $DRIZZLE_DUMP --compact test t1 > $drizzledumpfile
44
let $table_name = test.t1;
45
--source include/drizzledump.inc
46
47
--echo #
1543.1.4 by patrick crews
Fixed incorrectly altered test commenting to reflect the proper bug descriptions (mysqldump v. drizzledump)
48
--echo # Bug#3361 mysqldump quotes DECIMAL values inconsistently
1543.1.2 by patrick crews
Incorporated review feedback and deleted unused code from diff_tables.inc. Also fixed omission of the new include, test, and result files
49
--echo #
50
CREATE TABLE t1 (a DECIMAL(10,5), b FLOAT);
51
# Check at first how mysql work with quoted decimal
52
INSERT INTO t1 VALUES (1.2345, 2.3456);
53
INSERT INTO t1 VALUES ('1.2345', 2.3456);
54
INSERT INTO t1 VALUES ("1.2345", 2.3456);
55
INSERT INTO t1 VALUES (1.2345, 2.3456);
56
INSERT INTO t1 VALUES ('1.2345', 2.3456);
57
INSERT INTO t1 VALUES ("1.2345", 2.3456);
58
59
# check how drizzledump make quoting
60
--exec $DRIZZLE_DUMP --compact test t1 > $drizzledumpfile
61
let $table_name = test.t1;
62
--source include/drizzledump.inc
63
64
65
--echo #
66
--echo # WL#2319 Exclude Tables from dump
67
--echo #
68
CREATE TABLE t1 (a INT);
69
CREATE TABLE t2 (a INT);
70
INSERT INTO t1 VALUES (1),(2),(3);
71
INSERT INTO t2 VALUES (4),(5),(6);
72
--exec $DRIZZLE_DUMP --skip-comments --ignore-table=test.t1 test > $drizzledumpfile
73
let $table_name = test.t2;
74
--source include/drizzledump.inc
75
DROP TABLE t1;
76
77
--echo #
1543.1.4 by patrick crews
Fixed incorrectly altered test commenting to reflect the proper bug descriptions (mysqldump v. drizzledump)
78
--echo # Bug#8830 mysqldump --skip-extended-insert causes --hex-blob to dump wrong values
1543.1.2 by patrick crews
Incorporated review feedback and deleted unused code from diff_tables.inc. Also fixed omission of the new include, test, and result files
79
--echo #
80
CREATE TABLE t1 (`b` blob);
81
INSERT INTO `t1` VALUES (0x602010000280100005E71A);
1779.3.3 by Andrew Hutchings
Fix Drizzledump tests after removal of --hex-blob
82
--exec $DRIZZLE_DUMP --skip-extended-insert test --skip-comments t1 > $drizzledumpfile
1543.1.2 by patrick crews
Incorporated review feedback and deleted unused code from diff_tables.inc. Also fixed omission of the new include, test, and result files
83
let $table_name = test.t1;
84
--source include/drizzledump.inc
85
1643.4.2 by Patrick Crews
Added test case for bug#550091 to drizzledump_restore.test + updated result
86
--echo #
87
--echo # Bug#550091 in Drizzle: "drizzledump dumps data_dictionary"
88
--echo #
89
# We create a table in the test database
90
# We create an additional database and create a table there
91
# We dump all, then attempt to recreate and do some basic queries against
92
# our previously created tables
93
#
94
# We don't explicitly check the dumpfile for data_dictionary or
95
# information_schema output, but this test was failing on
96
# the unpatched drizzledump during dumping of data_dictionary
97
# information
98
99
100
CREATE TABLE t1 (a char(100), b int);
101
INSERT INTO t1 values ('a',100);
102
INSERT INTO t1 values ('b',200);
103
104
CREATE SCHEMA drizzledump_test;
105
USE drizzledump_test;
106
CREATE TABLE t1 (a int, b char(100));
107
INSERT INTO t1 VALUES (1, 'abbazabba');
108
109
# dump all databases here
110
--exec $DRIZZLE_DUMP --skip-comments --compact -A > $drizzledumpfile
111
112
--echo DROP original schemas
113
DROP DATABASE test;
114
DROP DATABASE drizzledump_test;
115
116
--echo Ensure we don't have those tables (verify we restored something)
2187.7.5 by Brian Aker
Merge in modifications such that we check both schema and table for
117
--ERROR ER_TABLE_UNKNOWN,ER_SCHEMA_DOES_NOT_EXIST
1643.4.2 by Patrick Crews
Added test case for bug#550091 to drizzledump_restore.test + updated result
118
SELECT * FROM test.t1;
2187.7.5 by Brian Aker
Merge in modifications such that we check both schema and table for
119
--ERROR ER_TABLE_UNKNOWN,ER_SCHEMA_DOES_NOT_EXIST
1643.4.2 by Patrick Crews
Added test case for bug#550091 to drizzledump_restore.test + updated result
120
SELECT * FROM drizzledump_test.t1;
121
122
--echo Restoring from dumpfile
123
--exec $DRIZZLE < $drizzledumpfile
124
125
USE test;
126
SELECT * FROM t1;
127
SELECT * FROM drizzledump_test.t1;
128
--echo Cleanup
129
DROP DATABASE drizzledump_test;
130
DROP TABLE t1;
131
1543.1.2 by patrick crews
Incorporated review feedback and deleted unused code from diff_tables.inc. Also fixed omission of the new include, test, and result files
132
--echo # End tests
133
134
--echo # Cleanup
135
--echo # remove drizzledumpfile
2107.1.1 by Brian Aker
Add in all of the error messages, also remove all cases of --error number
136
--error EE_OK,EE_ERROR_FIRST
1543.1.2 by patrick crews
Incorporated review feedback and deleted unused code from diff_tables.inc. Also fixed omission of the new include, test, and result files
137
--remove_file $drizzledumpfile