comparison worker_shutdown_timeout_stream.t @ 1245:6d7707405632

Tests: worker_shutdown_timeout within the stream module.
author Sergey Kandaurov <pluknet@nginx.com>
date Mon, 20 Nov 2017 17:55:49 +0300
parents
children caf59f42a3e1
comparison
equal deleted inserted replaced
1244:575d39cc0e35 1245:6d7707405632
1 #!/usr/bin/perl
2
3 # (C) Sergey Kandaurov
4 # (C) Nginx, Inc.
5
6 # Tests for worker_shutdown_timeout directive within the stream module.
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 use Test::Nginx::SMTP;
20
21 ###############################################################################
22
23 select STDERR; $| = 1;
24 select STDOUT; $| = 1;
25
26 local $SIG{PIPE} = 'IGNORE';
27
28 my $t = Test::Nginx->new()->has(qw/stream/)->plan(3)
29 ->write_file_expand('nginx.conf', <<'EOF');
30
31 %%TEST_GLOBALS%%
32
33 daemon off;
34 worker_shutdown_timeout 10ms;
35
36 events {
37 }
38
39 stream {
40 server {
41 listen 127.0.0.1:8025;
42 proxy_pass 127.0.0.1:8026;
43 }
44 }
45
46 EOF
47
48 $t->run_daemon(\&Test::Nginx::SMTP::smtp_test_daemon);
49 $t->run()->waitforsocket('127.0.0.1:' . port(8026));
50
51 ###############################################################################
52
53 my $s = Test::Nginx::SMTP->new();
54 $s->check(qr/^220 /, "greeting");
55
56 $s->send('EHLO example.com');
57 $s->check(qr/^250 /, "ehlo");
58
59 $t->reload();
60
61 TODO: {
62 local $TODO = 'not yet' unless $t->has_version('1.13.7');
63
64 ok($s->can_read(), 'stream connection shutdown');
65
66 }
67
68 undef $s;
69
70 ###############################################################################