diff options
Diffstat (limited to 'tests/maxinst.at')
-rw-r--r-- | tests/maxinst.at | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/tests/maxinst.at b/tests/maxinst.at new file mode 100644 index 0000000..f67d15e --- /dev/null +++ b/tests/maxinst.at | |||
@@ -0,0 +1,78 @@ | |||
1 | # This file is part of GNU pies testsuite. -*- Autotest -*- | ||
2 | # Copyright (C) 2019 Sergey Poznyakoff | ||
3 | # | ||
4 | # GNU pies is free software; you can redistribute it and/or modify | ||
5 | # it under the terms of the GNU General Public License as published by | ||
6 | # the Free Software Foundation; either version 3, or (at your option) | ||
7 | # any later version. | ||
8 | # | ||
9 | # GNU pies is distributed in the hope that it will be useful, | ||
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | # GNU General Public License for more details. | ||
13 | # | ||
14 | # You should have received a copy of the GNU General Public License | ||
15 | # along with GNU pies. If not, see <http://www.gnu.org/licenses/>. | ||
16 | |||
17 | AT_SETUP([inet component: max instances]) | ||
18 | AT_CHECK([ | ||
19 | PIES_XFAIL_CHECK | ||
20 | PIES_CONTROL_INIT | ||
21 | |||
22 | AT_DATA([in1], | ||
23 | [test | ||
24 | enable con2 | ||
25 | sleep 10 | ||
26 | quit | ||
27 | ]) | ||
28 | |||
29 | AT_DATA([in2], | ||
30 | [test | ||
31 | enable con3 | ||
32 | sleep 10 | ||
33 | quit | ||
34 | ]) | ||
35 | |||
36 | : ${PIES_TEST_INET_SOCKET:=unix://$PWD/in.sock} | ||
37 | |||
38 | cat > pies.conf <<_EOT | ||
39 | component in { | ||
40 | command "$auxdir/in.test /tmp/in.log"; | ||
41 | mode inetd; | ||
42 | socket "$PIES_TEST_INET_SOCKET"; | ||
43 | stderr file "$PWD/in.err"; | ||
44 | max-instances 2; | ||
45 | max-instances-message "too many instances running\n"; | ||
46 | } | ||
47 | component con1 { | ||
48 | command "nt $PIES_TEST_INET_SOCKET -i in1 -o con1.out"; | ||
49 | stderr file "/tmp/con1.err"; | ||
50 | } | ||
51 | component con2 { | ||
52 | command "nt $PIES_TEST_INET_SOCKET -i in2 -o con2.out"; | ||
53 | stderr file "/tmp/con2.err"; | ||
54 | flags (disable); | ||
55 | } | ||
56 | component con3 { | ||
57 | flags (disable); | ||
58 | command "nt $PIES_TEST_INET_SOCKET -o con3.out"; | ||
59 | stderr file "/tmp/con3.err"; | ||
60 | return-code * { | ||
61 | action disable; | ||
62 | exec "$abs_top_builddir/src/piesctl --url unix://$PWD/pies.ctl --no-netrc shutdown"; | ||
63 | } | ||
64 | } | ||
65 | _EOT | ||
66 | |||
67 | set -e | ||
68 | to 10 \ | ||
69 | pies --foreground --stderr \ | ||
70 | --config-file control.conf --config-file pies.conf --debug 1 2>errlog | ||
71 | |||
72 | cat con3.out | ||
73 | ], | ||
74 | [0], | ||
75 | [too many instances running | ||
76 | ]) | ||
77 | |||
78 | AT_CLEANUP | ||