sbotools2

Maintenance fork of the original sbotools version 2
git clone git://git.server.ky/slackcoder/sbotools2
Log | Files | Refs | README

26-race-sbocheck.t (638B)


      1 #!/usr/bin/env perl
      2 
      3 use strict;
      4 use warnings;
      5 use Test::More;
      6 use Test::Exit;
      7 use FindBin '$RealBin';
      8 use lib $RealBin;
      9 use Test::Sbotools 'load';
     10 use Capture::Tiny qw/ capture_merged /;
     11 use File::Temp 'tempdir';
     12 use Cwd;
     13 
     14 plan tests => 2;
     15 
     16 # 1-2: sbocheck race test...
     17 {
     18 	load('sbocheck');
     19 
     20 	my $logfile = '/var/log/sbocheck.log';
     21 	unlink $logfile;
     22 	mkdir $logfile;
     23 
     24 	my $exit;
     25 	my $out = capture_merged { $exit = exit_code { main::print_output('foo'); }; };
     26 
     27 	like ($out, qr/\QUnable to open $logfile./, "sbocheck's print_output() gave correct output");
     28 	is ($exit, undef, "sbocheck's print_output() didn't exit");
     29 
     30 	rmdir $logfile;
     31 }