start at 0.3.1 instead of 0.3.0
[scpubgit/Object-Remote.git] / t / watchdog_fatnode.t
CommitLineData
f129bfaf 1use strictures 1;
2use Test::More;
3
4require 't/logsetup.pl';
5
6use Object::Remote::Connector::Local;
7
8$SIG{ALRM} = sub { die "alarm signal\n" };
9
10open(my $nullfh, '>', '/dev/null') or die "Could not open /dev/null: $!";
11
8faf2a28 12my $fatnode_text = Object::Remote::Connector::Local->new(timeout => 1)->fatnode_text;
f129bfaf 13
14#this simulates a node that has hung before it reaches
15#the watchdog initialization - it's an edge case that
16#could cause remote processes to not get cleaned up
17#if it's not handled right
18eval {
19 no warnings 'once';
20 local *STDOUT = $nullfh;
21 $Object::Remote::FatNode::INHIBIT_RUN_NODE = 1;
22 eval $fatnode_text;
23
24 if ($@) {
25 die "could not eval fatnode text: $@";
26 }
27
28 while(1) {
29 sleep(1);
30 }
31};
32
33is($@, "alarm signal\n", "Alarm handler was invoked");
34
35done_testing;
36