comparison stream_access_log_none.t @ 1296:5d75938b2622

Tests: basic access_log tests with log_format 'escape=none'.
author Sergey Kandaurov <pluknet@nginx.com>
date Fri, 02 Mar 2018 19:16:54 +0300
parents
children 97c8280de681
comparison
equal deleted inserted replaced
1295:22a8982d5de6 1296:5d75938b2622
1 #!/usr/bin/perl
2
3 # (C) Sergey Kandaurov
4 # (C) Nginx, Inc.
5
6 # Stream tests for access_log with escape parameter.
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/stream stream_map stream_return/)
26 ->write_file_expand('nginx.conf', <<'EOF');
27
28 %%TEST_GLOBALS%%
29
30 daemon off;
31
32 events {
33 }
34
35 stream {
36 map $pid $a {
37 default '" \ "';
38 }
39 map $pid $b {
40 default "foo";
41 }
42
43 log_format none escape=none $a$b$upstream_addr;
44
45 server {
46 listen 127.0.0.1:8080;
47 return ok;
48
49 access_log %%TESTDIR%%/none.log none;
50 }
51 }
52
53 EOF
54
55 $t->try_run('no escape=none')->plan(1);
56
57 ###############################################################################
58
59 http_get('/');
60
61 $t->stop();
62
63 is($t->read_file('none.log'), '" \\ "foo' . "\n", 'none');
64
65 ###############################################################################