More 5.7 tests fixed

This commit is contained in:
Carlos Salguero
2017-04-27 16:44:46 -03:00
parent a6c55737f5
commit fcd1cb173f
12 changed files with 92 additions and 71 deletions

View File

@@ -55,6 +55,7 @@ $output = run_with("slow006.txt", qw(--create-review-table),
my ($table) = $dbh->selectrow_array(
"show tables from test like 'query_review'");
# 1
is($table, 'query_review', '--create-review-table');
$output = run_with("slow006.txt",
@@ -62,29 +63,32 @@ $output = run_with("slow006.txt",
my $res = $dbh->selectall_arrayref( 'SELECT * FROM test.query_review',
{ Slice => {} } );
my $expected = [ { checksum => '11676753765851784517',
reviewed_by => undef,
reviewed_on => undef,
last_seen => '2007-12-18 11:49:30',
first_seen => '2007-12-18 11:48:27',
sample => 'SELECT col FROM foo_tbl',
fingerprint => 'select col from foo_tbl',
comments => undef,
},
{ checksum => '15334040482108055940',
reviewed_by => undef,
reviewed_on => undef,
last_seen => '2007-12-18 11:49:07',
first_seen => '2007-12-18 11:48:57',
sample => 'SELECT col FROM bar_tbl',
fingerprint => 'select col from bar_tbl',
comments => undef,
},
];
my $expected = [
{
checksum => '11676753765851785216.00000000',
comments => undef,
fingerprint => 'select col from foo_tbl',
first_seen => '2007-12-18 11:48:27',
last_seen => '2007-12-18 11:49:30',
reviewed_by => undef,
reviewed_on => undef,
sample => 'SELECT col FROM foo_tbl'
},
{
checksum => '15334040482108055552.00000000',
comments => undef,
fingerprint => 'select col from bar_tbl',
first_seen => '2007-12-18 11:48:57',
last_seen => '2007-12-18 11:49:07',
reviewed_by => undef,
reviewed_on => undef,
sample => 'SELECT col FROM bar_tbl'
}
];
normalize_numbers($res);
normalize_numbers($expected);
# 2
is_deeply(
$res,
$expected,
@@ -138,22 +142,25 @@ ok(
# Make sure that when we run with all-0 timestamps they don't show up in the
# output because they are useless of course (issue 202).
# Since some sql_modes don't allow '0000-00-00' dates, to keep this test valid
# we simply remove them for a moment and then restore.
my $modes = new SqlModes($dbh);
$modes->del(qw(STRICT_TRANS_TABLES STRICT_ALL_TABLES NO_ZERO_IN_DATE NO_ZERO_DATE));
my $currmodes = $modes->get_modes_string();
$dbh->do("update test.query_review set first_seen='0000-00-00 00:00:00', "
. " last_seen='0000-00-00 00:00:00'");
$output = run_with("slow022.txt",
'--review', "$dsn,D=test,t=query_review");
unlike($output, qr/last_seen/, 'no last_seen when 0000 timestamp');
unlike($output, qr/first_seen/, 'no first_seen when 0000 timestamp');
unlike($output, qr/0000-00-00 00:00:00/, 'no 0000-00-00 00:00:00 timestamp');
$modes->restore_original_modes();
SKIP: {
skip "MySQL 5.7 doesn't allow '0000-00-00' dates" if ($sandbox_version ge '5.7');
# Since some sql_modes don't allow '0000-00-00' dates, to keep this test valid
# we simply remove them for a moment and then restore.
my $modes = new SqlModes($dbh);
$modes->del(qw(STRICT_TRANS_TABLES STRICT_ALL_TABLES NO_ZERO_IN_DATE NO_ZERO_DATE));
my $currmodes = $modes->get_modes_string();
$dbh->do("update test.query_review set first_seen='0000-00-00 00:00:00', "
. " last_seen='0000-00-00 00:00:00'");
$output = run_with("slow022.txt",
'--review', "$dsn,D=test,t=query_review");
unlike($output, qr/last_seen/, 'no last_seen when 0000 timestamp');
unlike($output, qr/first_seen/, 'no first_seen when 0000 timestamp');
unlike($output, qr/0000-00-00 00:00:00/, 'no 0000-00-00 00:00:00 timestamp');
$modes->restore_original_modes();
}
# ##########################################################################
# XXX The following tests will cause non-deterministic data, so run them