-
Notifications
You must be signed in to change notification settings - Fork 81
/
Copy pathworker_shutdown_timeout_stream.t
68 lines (43 loc) · 1.28 KB
/
worker_shutdown_timeout_stream.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/perl
# (C) Sergey Kandaurov
# (C) Nginx, Inc.
# Tests for worker_shutdown_timeout directive within the stream module.
###############################################################################
use warnings;
use strict;
use Test::More;
BEGIN { use FindBin; chdir($FindBin::Bin); }
use lib 'lib';
use Test::Nginx;
use Test::Nginx::SMTP;
###############################################################################
select STDERR; $| = 1;
select STDOUT; $| = 1;
local $SIG{PIPE} = 'IGNORE';
my $t = Test::Nginx->new()->has(qw/stream/)->plan(3)
->write_file_expand('nginx.conf', <<'EOF');
%%TEST_GLOBALS%%
daemon off;
worker_shutdown_timeout 10ms;
events {
}
stream {
%%TEST_GLOBALS_STREAM%%
server {
listen 127.0.0.1:8025;
proxy_pass 127.0.0.1:8026;
}
}
EOF
$t->run_daemon(\&Test::Nginx::SMTP::smtp_test_daemon);
$t->run()->waitforsocket('127.0.0.1:' . port(8026));
###############################################################################
my $s = Test::Nginx::SMTP->new();
$s->check(qr/^220 /, "greeting");
$s->send('EHLO example.com');
$s->check(qr/^250 /, "ehlo");
$t->reload();
ok($s->can_read(), 'stream connection shutdown');
undef $s;
1;
###############################################################################