File: watchdog_fatnode.t

package info (click to toggle)
libobject-remote-perl 0.004000-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 488 kB
  • ctags: 248
  • sloc: perl: 2,408; makefile: 7
file content (33 lines) | stat: -rw-r--r-- 703 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use strictures 1;
use Test::More;

$ENV{OBJECT_REMOTE_TEST_LOGGER} = 1;

use Object::Remote::Connector::Local;

$SIG{ALRM} = sub { die "alarm signal\n" };

my $fatnode_text = Object::Remote::Connector::Local->new(timeout => 1)->fatnode_text;

#this simulates a node that has hung before it reaches
#the watchdog initialization - it's an edge case that
#could cause remote processes to not get cleaned up
#if it's not handled right
eval {
  no warnings 'once';
  $Object::Remote::FatNode::INHIBIT_RUN_NODE = 1;
  eval $fatnode_text;

  if ($@) {
      die "could not eval fatnode text: $@";
  }

  while(1) {
      sleep(1);
  }
};

is($@, "alarm signal\n", "Alarm handler was invoked");

done_testing;