mirror of
https://github.com/percona/percona-toolkit.git
synced 2026-04-03 01:02:14 +08:00
PT-1574 Added a test case
This commit is contained in:
@@ -24,7 +24,7 @@ use File::Temp qw/ tempdir /;
|
||||
if ($sandbox_version lt '5.7') {
|
||||
plan skip_all => 'This test needs MySQL 5.7+';
|
||||
} else {
|
||||
plan tests => 3;
|
||||
plan tests => 5;
|
||||
}
|
||||
|
||||
require "$trunk/bin/pt-online-schema-change";
|
||||
@@ -65,6 +65,27 @@ like(
|
||||
"PT-1544 Message you need an unique index.",
|
||||
);
|
||||
|
||||
($output, $exit_status) = full_output(
|
||||
sub { pt_online_schema_change::main(@args, "$dsn,D=test,t=t2",
|
||||
'--execute', "--chunk-index", "idx_id", "--chunk-size", "1",
|
||||
"--nocheck-plan", '--alter', "engine=innodb",
|
||||
),
|
||||
},
|
||||
stderr => 1,
|
||||
);
|
||||
|
||||
isnt(
|
||||
$exit_status,
|
||||
0,
|
||||
"PT-1544 There is no unique index exit status",
|
||||
);
|
||||
|
||||
like(
|
||||
$output,
|
||||
qr/at least one UNIQUE and NOT NULLABLE index/s,
|
||||
"PT-1544 Message you need an unique index.",
|
||||
);
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
|
||||
@@ -11,7 +11,7 @@ KEY `idx_last_update` (`last_update`),
|
||||
KEY `idx_site_name` (`site_name`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
INSERT INTO `t1` VALUES
|
||||
INSERT INTO `test`.`t1` VALUES
|
||||
(1385108873,'Carolyn Ryan','2018-01-13 17:05:24'),
|
||||
(2140660022,'Patricia Garza','2018-01-13 19:07:51'),
|
||||
(1473481373,'Rachel George','2017-12-05 21:09:53'),
|
||||
@@ -20,3 +20,21 @@ INSERT INTO `t1` VALUES
|
||||
(1275940242,'Lois Spencer','2018-02-22 01:01:38'),
|
||||
(NULL,NULL,NULL),
|
||||
(NULL,NULL,NULL);
|
||||
|
||||
|
||||
CREATE TABLE `test`.`t2` (
|
||||
`id` int(11) DEFAULT NULL,
|
||||
`site_name` varchar(25) PRIMARY KEY,
|
||||
`last_update` datetime DEFAULT NULL,
|
||||
UNIQUE KEY `idx_id` (`id`),
|
||||
KEY `idx_last_update` (`last_update`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
|
||||
INSERT INTO `test`.`t2` VALUES
|
||||
(1385108873,'Carolyn Ryan','2018-01-13 17:05:24'),
|
||||
(2140660022,'Patricia Garza','2018-01-13 19:07:51'),
|
||||
(1473481373,'Rachel George','2017-12-05 21:09:53'),
|
||||
(1394124308,'Mrs. Ms. Miss Janet Dixon','2017-10-28 07:07:41'),
|
||||
(1978918050,'Louis Gray Jr. Sr. I II I','2017-11-01 22:10:39'),
|
||||
(1275940242,'Lois Spencer','2018-02-22 01:01:38'),
|
||||
(NULL,"aaa",NULL);
|
||||
|
||||
Reference in New Issue
Block a user