PageRenderTime 18ms CodeModel.GetById 10ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/t/75-plugin-include.t

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