/t/75-plugin-include.t

http://github.com/perlbal/Perlbal · Perl · 48 lines · 32 code · 14 blank · 2 comment · 2 complexity · 58f760e3e078fbb41eff1d3fa251e911 MD5 · raw file

  1. #!/usr/bin/perl
  2. use strict;
  3. use Perlbal::Test;
  4. use Test::More tests => 8;
  5. require HTTP::Request;
  6. require HTTP::Date;
  7. my $dir = tempdir();
  8. my $msock = start_server();
  9. ok($msock, "manage sock");
  10. ok(manage("LOAD Include"), "load include");
  11. # Build conf files
  12. for ('a' .. 'c') {
  13. my $port = new_port();
  14. my $conf = qq{
  15. CREATE SERVICE test_$_
  16. SET test_$_.role = web_server
  17. SET test_$_.listen = 127.0.0.1:$port
  18. SET test_$_.docroot = $dir
  19. SET test_$_.dirindexing = 0
  20. SET test_$_.persist_client = 1
  21. ENABLE test_$_
  22. };
  23. open(F, ">$dir/$_.conf") or die "Couldn't open $dir/$_.conf: $!\n";
  24. print F $conf;
  25. close F;
  26. }
  27. ok(manage("INCLUDE = $dir/a.conf"), "include single");
  28. ok(manage("INCLUDE = $dir/b* $dir/c*"), "include multi");
  29. ok(! manage("INCLUDE = $dir/d.conf", quiet_failure => 1), "error on nonexistent conf");
  30. my $s_output = manage_multi("show SERVICE");
  31. for ('a' .. 'c') {
  32. like($s_output, qr/^test_$_ .+ ENABLED/m, "test_$_ loaded");
  33. }
  34. 1;