Improve MasterSlave::check_recursion_method() tests.

This commit is contained in:
Daniel Nichter
2013-10-02 11:15:58 -07:00
parent 2411cf6880
commit b0cacd15f4
2 changed files with 42 additions and 16 deletions

View File

@@ -11,10 +11,6 @@ use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More;
if ( !$ENV{SLOW_TESTS} ) {
plan skip_all => "lib/MasterSlave.t is a top 5 slowest file; set SLOW_TESTS=1 to enable it.";
}
use MasterSlave;
use DSNParser;
use VersionParser;
@@ -709,28 +705,51 @@ is(
# ############################################################################
# Invalid recursion methods are caught
# ############################################################################
local $EVAL_ERROR;
eval {
MasterSlave::check_recursion_method([qw(stuff)])
};
like(
$EVAL_ERROR,
qr/Invalid recursion method: stuff/,
"--recursion-method stuff causes error"
);
local $EVAL_ERROR;
eval {
MasterSlave::check_recursion_method([qw(processlist stuff)])
};
like(
$EVAL_ERROR,
qr/Invalid combination of recursion methods: processlist, stuff/,
qr/Invalid recursion method: stuff/,
"--recursion-method processlist,stuff causes error",
);
eval {
MasterSlave::check_recursion_method([qw(none hosts)])
};
like(
$EVAL_ERROR,
qr/none cannot be combined with other methods/,
"--recursion-method none,hosts"
);
eval {
MasterSlave::check_recursion_method([qw(cluster none)])
};
like(
$EVAL_ERROR,
qr/none cannot be combined with other methods/,
"--recursion-method cluster,none"
);
eval {
MasterSlave::check_recursion_method([qw(none none)])
};
like(
$EVAL_ERROR,
qr/Invalid combination of recursion methods: none, none/,
"--recursion-method none,none"
);
# #############################################################################
# Done.
# #############################################################################