made remote timeout configurable by env
[scpubgit/System-Introspector.git] / t / filehandles.t
1 use strictures 1;
2 use Test::More;
3 use FindBin;
4
5 use System::Introspector::Probe::FileHandles;
6
7 $ENV{PATH} = "$FindBin::Bin/bin:" . $ENV{PATH};
8
9 my $probe = System::Introspector::Probe::FileHandles->new;
10
11 my $data = $probe->gather;
12 ok($data, 'received result');
13
14 my $handles = $data->{handles};
15 ok($handles, 'received filehandle data');
16 ok(not(grep { not keys %$_ } @$handles), 'keys in all entries');
17
18 do {
19     my $fail_probe = System::Introspector::Probe::FileHandles->new(
20         lsof_command => 'lsoffakethisonedoesntexistatleastihopenot',
21     );
22     my $fail_data;
23     $fail_data = $fail_probe->gather;
24     ok $fail_data, 'received data';
25     like $fail_data->{__error__}, qr{lsoffake}, 'correct error is set';
26 };
27
28 done_testing;