Files
percona-toolkit/t/lib/VersionParser.t
2012-06-05 13:50:41 -03:00

53 lines
1.3 KiB
Perl

#!/usr/bin/perl
BEGIN {
die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
};
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More tests => 5;
use VersionParser;
use PerconaTest;
my $vp = new VersionParser;
is(
$vp->parse('5.0.38-Ubuntu_0ubuntu1.1-log'),
'005000038',
'Parser works on ordinary version',
);
is(
$vp->parse('5.5'),
'005005000',
'Parser works on a simplified version',
);
# Open a connection to MySQL, or skip the rest of the tests.
use DSNParser;
use Sandbox;
my $dp = new DSNParser(opts=>$dsn_opts);
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
my $dbh = $sb->get_dbh_for('master');
SKIP: {
skip 'Cannot connect to MySQL', 2 unless $dbh;
ok($vp->version_ge($dbh, '3.23.00'), 'Version is > 3.23');
unlike(
$vp->innodb_version($dbh),
qr/DISABLED/,
"InnoDB version"
);
}
# #############################################################################
# Done.
# #############################################################################
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
exit;