~percona-toolkit-dev/percona-toolkit/release-2.2.3

« back to all changes in this revision

Viewing changes to t/lib/UpgradeResults.t

  • Committer: Daniel Nichter
  • Date: 2013-03-12 15:21:13 UTC
  • mfrom: (507.1.37 pt-upgrade-2.2)
  • Revision ID: daniel@percona.com-20130312152113-jfkrxi3p8ca84oin
Merge pt-upgrade-2.2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
 
 
3
BEGIN {
 
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";
 
7
};
 
8
 
 
9
use strict;
 
10
use warnings FATAL => 'all';
 
11
use English qw(-no_match_vars);
 
12
use Test::More;
 
13
 
 
14
use UpgradeResults;
 
15
use PerconaTest;
 
16
 
 
17
my $output;
 
18
my $samples = "t/lib/samples/UpgradeResults";
 
19
 
 
20
my $r = new UpgradeResults(
 
21
   max_class_size => 100,
 
22
   max_examples   => 3,
 
23
);
 
24
 
 
25
# #############################################################################
 
26
# _format_query_times()
 
27
# #############################################################################
 
28
 
 
29
$output = UpgradeResults::_format_query_times(
 
30
   [
 
31
      'INSERT INTO t (id, username) VALUES (NULL, \'long_username\')',
 
32
      '0.000812',
 
33
      '0.039595',
 
34
      '48.8'
 
35
   ],
 
36
);
 
37
 
 
38
ok(
 
39
   no_diff(
 
40
      $output,
 
41
      "$samples/format_query_times001",
 
42
      cmd_output => 1,
 
43
   ),
 
44
   "format_query_times001"
 
45
) or diag($test_diff);
 
46
 
 
47
# #############################################################################
 
48
# Done.
 
49
# #############################################################################
 
50
done_testing;