Skip to content

Commit 0d90dd0

Browse files
committed
Tests: worker_shutdown_timeout within the stream module.
1 parent 7b102f8 commit 0d90dd0

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

worker_shutdown_timeout_stream.t

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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+
###############################################################################

0 commit comments

Comments
 (0)