mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-02 02:34:19 +00:00
PT-96 Fixed OptionParser tests (race condition)
This commit is contained in:
@@ -15,6 +15,7 @@ use OptionParser;
|
|||||||
use DSNParser;
|
use DSNParser;
|
||||||
use PerconaTest;
|
use PerconaTest;
|
||||||
|
|
||||||
|
use Test::More tests => 161;
|
||||||
my $o = new OptionParser(
|
my $o = new OptionParser(
|
||||||
description => 'OptionParser.t parses command line options.',
|
description => 'OptionParser.t parses command line options.',
|
||||||
usage => "$PROGRAM_NAME <options>",
|
usage => "$PROGRAM_NAME <options>",
|
||||||
@@ -1280,6 +1281,17 @@ ok(
|
|||||||
);
|
);
|
||||||
|
|
||||||
@ARGV = ('--bar', 'D=DB,u=USER,h=localhost', '--foo', 'h=otherhost');
|
@ARGV = ('--bar', 'D=DB,u=USER,h=localhost', '--foo', 'h=otherhost');
|
||||||
|
$o = new OptionParser(
|
||||||
|
description => 'OptionParser.t parses command line options.',
|
||||||
|
usage => "$PROGRAM_NAME <options>"
|
||||||
|
);
|
||||||
|
# Hack DSNParser into OptionParser. This is just for testing.
|
||||||
|
$o->{DSNParser} = $dp;
|
||||||
|
$o->_parse_specs(
|
||||||
|
{ spec => 'foo=d', desc => 'DSN foo' },
|
||||||
|
{ spec => 'bar=d', desc => 'DSN bar' },
|
||||||
|
'DSN values in --foo default to values in --bar if COPY is yes.',
|
||||||
|
);
|
||||||
$o->get_opts();
|
$o->get_opts();
|
||||||
is_deeply(
|
is_deeply(
|
||||||
$o->get('bar'),
|
$o->get('bar'),
|
||||||
@@ -1779,6 +1791,13 @@ is_deeply(
|
|||||||
'DSN opt gets missing vals from --host, --port, etc. (issue 248)',
|
'DSN opt gets missing vals from --host, --port, etc. (issue 248)',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$o = new OptionParser(
|
||||||
|
description => 'OptionParser.t parses command line options.',
|
||||||
|
usage => "$PROGRAM_NAME <options>"
|
||||||
|
);
|
||||||
|
# Hack DSNParser into OptionParser. This is just for testing.
|
||||||
|
$o->{DSNParser} = $dp;
|
||||||
|
$o->get_specs("$trunk/bin/pt-archiver");
|
||||||
# Like case ii. but make sure --dest copies u from --source, not --user.
|
# Like case ii. but make sure --dest copies u from --source, not --user.
|
||||||
@ARGV = (
|
@ARGV = (
|
||||||
'--source', 'h=127.1,u=bob',
|
'--source', 'h=127.1,u=bob',
|
||||||
|
Reference in New Issue
Block a user