4
die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n"
5
unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH};
6
unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib";
10
use warnings FATAL => 'all';
11
use English qw(-no_match_vars);
20
my $dp = new DSNParser(opts=>$dsn_opts);
21
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
22
my $dbh = $sb->get_dbh_for('master');
24
my $vc = VersionCheck->new();
29
my $items = $vc->parse_server_response(
30
response => $args{response},
38
my $versions = $vc->get_versions(
42
diag(Dumper($versions));
46
"$args{name} versions"
49
# Perl 5.8 $^V/$PERL_VERSION is borked, make sure
50
# the module is coping with it.
51
if ( $items->{Perl} ) {
55
"Perl version looks like a version"
63
name => "Perl version",
64
response => "Perl;perl_version\n",
68
type => 'perl_version',
73
'Perl' => sprintf('%vd', $PERL_VERSION),
78
name => "perl_module_version",
79
response => "Data::Dumper;perl_module_version\n",
82
item => 'Data::Dumper',
83
type => 'perl_module_version',
88
'Data::Dumper' => $Data::Dumper::VERSION,
93
name => "bin_version",
94
response => "perl;bin_version\n",
98
type => 'bin_version',
103
'perl' => sprintf('%vd', $PERL_VERSION),
109
local $ENV{PATH} = "$ENV{PATH}:" . File::Spec->catfile($ENV{PERCONA_TOOLKIT_BRANCH}, "bin");
111
name => "bin_version",
112
response => "pt-archiver;bin_version\n",
115
item => 'pt-archiver',
116
type => 'bin_version',
121
'pt-archiver' => $Sandbox::Percona::Toolkit::VERSION,
127
skip "Cannot cannot to sandbox master", 2 unless $dbh;
129
my (undef, $mysql_version)
130
= $dbh->selectrow_array("SHOW VARIABLES LIKE 'version'");
131
my (undef, $mysql_distro)
132
= $dbh->selectrow_array("SHOW VARIABLES LIKE 'version_comment'");
135
name => "mysql_variable",
136
response => "MySQL;mysql_variable;version_comment,version\n",
140
type => 'mysql_variable',
141
vars => [qw(version_comment version)],
145
'MySQL' => "$mysql_distro $mysql_version",
150
# I can't think of a way to make these 2 OS tests more specific
151
# since the test env doesn't know what OS its running on. We
152
# at least know that an OS should have these two things: a word
153
# and version with at least major and minor numbers.
154
my $os = $vc->get_os_version;
160
"OS has some kind of name"
166
"OS has some kind of version"
169
# get_os() runs a lot of shell cmds that include newlines,
170
# but the client's response can't have newlines in the versions
171
# becuase newlines separate items.
174
"Newline stripped from OS"
178
# #############################################################################
180
# #############################################################################
182
my $versions = $vc->get_versions(
186
type => 'perl_variable',
195
"perl_variable is not a valid type"
198
# #############################################################################
200
# #############################################################################
201
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox")