Deleted Added
1import unittest
2import unit
3
4class TestUnitPythonApplication(unit.TestUnitApplicationPython):
5
6 def setUpClass():
7 unit.TestUnit().check_modules('python')
8

--- 95 unchanged lines hidden (view full) ---

104 resp = self.post(headers={
105 'Connection': 'close',
106 'Content-Type': 'text/html',
107 'Host': 'localhost'
108 }, sock=sock, body='0123456789')
109
110 self.assertEqual(resp['body'], '0123456789', 'keep-alive 2')
111
112 def test_python_keepalive_reconfigure(self):
113 self.skip_alerts.extend([
114 r'sendmsg.+failed',
115 r'recvmsg.+failed'
116 ])
117 self.load('mirror')
118
119 body = '0123456789'
120 conns = 3
121 socks = []
122
123 for i in range(conns):
124 (resp, sock) = self.post(headers={
125 'Connection': 'keep-alive',
126 'Content-Type': 'text/html',
127 'Host': 'localhost'
128 }, start=True, body=body)
129
130 self.assertEqual(resp['body'], body, 'keep-alive open')
131 self.assertIn('success', self.conf({
132 "spare": i % 4,
133 "max": (i % 4) + 1
134 }, '/applications/mirror/processes'), 'reconfigure')
135
136 socks.append(sock)
137
138 for i in range(conns):
139 (resp, sock) = self.post(headers={
140 'Connection': 'keep-alive',
141 'Content-Type': 'text/html',
142 'Host': 'localhost'
143 }, start=True, sock=socks[i], body=body)
144
145 self.assertEqual(resp['body'], body, 'keep-alive request')
146 self.assertIn('success', self.conf({
147 "spare": i % 4,
148 "max": (i % 4) + 1
149 }, '/applications/mirror/processes'), 'reconfigure 2')
150
151 for i in range(conns):
152 resp = self.post(headers={
153 'Connection': 'close',
154 'Content-Type': 'text/html',
155 'Host': 'localhost'
156 }, sock=socks[i], body=body)
157
158 self.assertEqual(resp['body'], body, 'keep-alive close')
159 self.assertIn('success', self.conf({
160 "spare": i % 4,
161 "max": (i % 4) + 1
162 }, '/applications/mirror/processes'), 'reconfigure 3')
163
164 def test_python_atexit(self):
165 self.skip_alerts.append(r'sendmsg.+failed')
166 self.load('atexit')
167
168 self.get()
169
170 self.conf({
171 "listeners": {},

--- 130 unchanged lines hidden ---