Skip to content

Commit

Permalink
Explicitly test shutdown called multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
theory committed Feb 18, 2024
1 parent 02eb7a9 commit 5a87f3f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions t/consumer.t
Original file line number Diff line number Diff line change
Expand Up @@ -484,12 +484,12 @@ SIGNALS: {
# Let's execute them. Mock _shutdown.
my $mock = Test::MockModule->new($CLASS);
my $shutdown_called;
$mock->mock(_shutdown => sub { $shutdown_called = 1 });
$mock->mock(_shutdown => sub { ++$shutdown_called });

# Now try them.
for my $sig (@sigs) {
ok $SIG{$sig}->(), "Call $sig";
ok $shutdown_called, "$sig should have called shutdown";
is $shutdown_called, 1, "$sig should have called shutdown";
is output(), "$logtime - INFO: $sig signal caught\n",
"Should have logged the $sig signal";
$shutdown_called = 0;
Expand All @@ -502,7 +502,7 @@ SIGNALS: {
# Now try them again.
for my $sig (@sigs) {
ok $SIG{$sig}->(), "Call $sig again";
ok $shutdown_called, "$sig should have again called shutdown";
is $shutdown_called, 2, "$sig should have called shutdown twice";
is output(), join("\n",
"$logtime - INFO: $sig signal caught",
"$logtime - INFO: $sig signal caught",
Expand Down

0 comments on commit 5a87f3f

Please sign in to comment.