PT-204 Added tests

This commit is contained in:
Carlos Salguero
2017-12-06 11:18:25 -03:00
parent b2325fee38
commit 5a53f966c2
3 changed files with 84 additions and 21 deletions

View File

@@ -577,6 +577,25 @@ sub do_as_root {
return $ok;
}
sub has_engine {
my ( $self, $host, $want_engine ) = @_;
# Get the current checksums on the host.
my $dbh = $self->get_dbh_for($host);
my $sql = "SHOW ENGINES";
my @engines = @{$dbh->selectall_arrayref($sql, {Slice => {} })};
# Diff the two sets of checksums: host to master (ref).
my $has_engine=0;
foreach my $engine ( @engines ) {
if ( $engine->{engine} =~ m/$want_engine/i ) {
$has_engine=1;
last;
}
}
return $has_engine;
}
sub _d {
my ($package, undef, $line) = caller 0;
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }