3 no warnings qw(redefine once);
8 use Test::More tests => 6;
14 require './l7directord';
17 our @system_wrapper_args = ();
18 our @system_wrapper_returns = ();
19 #...............................................
24 local @system_wrapper_args = ();
25 local @system_wrapper_returns = ();
27 is_deeply \@system_wrapper_args, [], 'ld_cmd_children - no execute';
31 local @system_wrapper_args = ();
32 local @system_wrapper_returns = ();
33 $main::CONFIG{execute} = { subconf1 => 1, subconf2 => 1 };
35 is_deeply \@system_wrapper_args, [], 'ld_cmd_children - exists execute, but no command';
39 local @system_wrapper_args = ();
40 local @system_wrapper_returns = ();
41 $main::CONFIG{execute} = { subconf1 => 1, subconf2 => 1 };
42 ld_cmd_children('start');
43 is_deeply \@system_wrapper_args, ['l7directord subconf1 start', 'l7directord subconf2 start'],
44 'ld_cmd_children - exists execute and command';
48 local @system_wrapper_args = ();
49 local @system_wrapper_returns = ();
50 $main::CONFIG{execute} = { subconf1 => 1, subconf2 => 1 };
51 ld_cmd_children('start', {});
52 is_deeply \@system_wrapper_args, [], 'ld_cmd_children - specified empty config';
56 local @system_wrapper_args = ();
57 local @system_wrapper_returns = ();
58 my $execute = { subconf1 => 1, subconf2 => 1 };
59 ld_cmd_children(undef, $execute);
60 is_deeply \@system_wrapper_args, [], 'ld_cmd_children - specified config but not exist command';
64 local @system_wrapper_args = ();
65 local @system_wrapper_returns = ();
66 my $execute = { subconf1 => 1, subconf2 => 1 };
67 ld_cmd_children('start', $execute);
68 is_deeply \@system_wrapper_args, ['l7directord subconf1 start', 'l7directord subconf2 start'],
69 'ld_cmd_children - specified config and exists command';
72 #...............................................
77 %main::CONFIG = %main::GLOBAL;
78 $main::PROC_ENV{l7directord} = 'l7directord';
81 *system_wrapper = \&__system_wrapper;
84 sub __system_wrapper {
85 push @system_wrapper_args, @_;
86 return shift @system_wrapper_returns;