Updated all tests for PS 5.7

This commit is contained in:
Carlos Salguero
2017-12-18 13:01:11 -03:00
parent bb3334de08
commit 5c106b4fad
3 changed files with 26 additions and 4 deletions

View File

@@ -43,6 +43,9 @@ $dbh2->commit;
$dbh1->{InactiveDestroy} = 1;
$dbh2->{InactiveDestroy} = 1;
$dbh1->{mysql_auto_reconnect} = 1;
$dbh2->{mysql_auto_reconnect} = 1;
sub make_deadlock {
# Fork off two children to deadlock against each other.
my %children;
@@ -82,12 +85,28 @@ sub make_deadlock {
foreach my $child ( keys %children ) {
my $pid = waitpid($children{$child}, 0);
}
$dbh1->commit;
$dbh2->commit;
eval {
$dbh1->commit;
$dbh1->disconnect();
};
eval {
$dbh2->commit;
$dbh2->disconnect();
};
}
sub reconnect {
my $dbh = shift;
$dbh->disconnect();
$dbh = $sb->get_dbh_for('master', { PrintError => 0, RaiseError => 1, AutoCommit => 0 });
return $dbh;
}
make_deadlock();
$dbh1 = reconnect($dbh1);
$dbh2 = reconnect($dbh2);
# Test that there is a deadlock
$output = $dbh1->selectrow_hashref('show /*!40101 engine*/ innodb status')->{status};
like($output, qr/WE ROLL BACK/, 'There was a deadlock');
@@ -208,6 +227,9 @@ SKIP: {
# #############################################################################
# Done.
# #############################################################################
$dbh1 = reconnect($dbh1);
$dbh2 = reconnect($dbh2);
$dbh1->commit;
$dbh2->commit;
$sb->wipe_clean($dbh1);