comparison http_block.t @ 606:530a3152753b

Tests: simple http proxy test with multiple http blocks.
author Sergey Kandaurov <pluknet@nginx.com>
date Mon, 15 Jun 2015 19:59:59 +0300
parents
children
comparison
equal deleted inserted replaced
605:a77f19282f63 606:530a3152753b
1 #!/usr/bin/perl
2
3 # (C) Sergey Kandaurov
4 # (C) Nginx, Inc.
5
6 # Tests for http proxy module with multiple http configuration blocks.
7
8 ###############################################################################
9
10 use warnings;
11 use strict;
12
13 use Test::More;
14
15 BEGIN { use FindBin; chdir($FindBin::Bin); }
16
17 use lib 'lib';
18 use Test::Nginx;
19
20 ###############################################################################
21
22 select STDERR; $| = 1;
23 select STDOUT; $| = 1;
24
25 my $t = Test::Nginx->new()->has(qw/http proxy/)->plan(1);
26
27 $t->write_file_expand('nginx.conf', <<'EOF');
28
29 %%TEST_GLOBALS%%
30
31 daemon off;
32
33 events {
34 }
35
36 http {
37 %%TEST_GLOBALS_HTTP%%
38
39 server {
40 listen 127.0.0.1:8080;
41 server_name localhost;
42
43 location / {
44 proxy_pass http://127.0.0.1:8081;
45 proxy_read_timeout 1s;
46 }
47 }
48 }
49
50 http {
51 %%TEST_GLOBALS_HTTP%%
52
53 server {
54 listen 127.0.0.1:8081;
55 server_name localhost;
56
57 location / {}
58 }
59 }
60
61 EOF
62
63 $t->write_file('t', 'SEE-THIS');
64 $t->run();
65
66 ###############################################################################
67
68 like(http_get('/t'), qr/SEE-THIS/, 'proxy request');
69
70 ###############################################################################