check_users.t 565 B

12345678910111213141516171819202122232425262728
  1. #! /usr/bin/perl -w
  2. use strict;
  3. use Cache;
  4. use Test;
  5. use vars qw($tests);
  6. BEGIN {$tests = 4; plan tests => $tests}
  7. my $null = '';
  8. my $cmd;
  9. my $str;
  10. my $t;
  11. $cmd = "./check_users 1000 1000";
  12. $str = `$cmd`;
  13. $t += ok $?>>8,0;
  14. print "Test was: $cmd\n" if ($?);
  15. $t += ok $str, '/^USERS OK - +[0-9]+ users currently logged in$/';
  16. $cmd = "./check_users 0 0";
  17. $str = `$cmd`;
  18. $t += ok $?>>8,2;
  19. print "Test was: $cmd\n" unless ($?);
  20. $t += ok $str, '/^USERS CRITICAL - [0-9]+ +users currently logged in$/';
  21. exit(0) if defined($Test::Harness::VERSION);
  22. exit($tests - $t);