test_proxy.py (1635:97afbb6c5a15) test_proxy.py (1654:fc7d0578e124)
1import re
2import socket
3import time
4
5import pytest
6
7from conftest import option
1import re
2import socket
3import time
4
5import pytest
6
7from conftest import option
8from conftest import run_process
8from conftest import skip_alert
9from conftest import skip_alert
10from conftest import waitforsocket
9from unit.applications.lang.python import TestApplicationPython
10
11
12class TestProxy(TestApplicationPython):
13 prerequisites = {'modules': {'python': 'any'}}
14
15 SERVER_PORT = 7999
16

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

55
56 def get_http10(self, *args, **kwargs):
57 return self.get(*args, http_10=True, **kwargs)
58
59 def post_http10(self, *args, **kwargs):
60 return self.post(*args, http_10=True, **kwargs)
61
62 def setup_method(self):
11from unit.applications.lang.python import TestApplicationPython
12
13
14class TestProxy(TestApplicationPython):
15 prerequisites = {'modules': {'python': 'any'}}
16
17 SERVER_PORT = 7999
18

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

57
58 def get_http10(self, *args, **kwargs):
59 return self.get(*args, http_10=True, **kwargs)
60
61 def post_http10(self, *args, **kwargs):
62 return self.post(*args, http_10=True, **kwargs)
63
64 def setup_method(self):
63 super().setup_method()
65 run_process(self.run_server, self.SERVER_PORT)
66 waitforsocket(self.SERVER_PORT)
64
67
65 self.run_process(self.run_server, self.SERVER_PORT)
66 self.waitforsocket(self.SERVER_PORT)
67
68 assert 'success' in self.conf(
69 {
70 "listeners": {
71 "*:7080": {"pass": "routes"},
72 "*:7081": {"pass": "applications/mirror"},
73 },
74 "routes": [{"action": {"proxy": "http://127.0.0.1:7081"}}],
75 "applications": {

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

341 ), 'add ipv6 listener configure'
342
343 assert 'success' in self.conf(
344 [{"action": {"proxy": "http://[::1]:7081"}}], 'routes'
345 ), 'proxy ipv6 configure'
346
347 assert self.get_http10()['status'] == 200, 'status'
348
68 assert 'success' in self.conf(
69 {
70 "listeners": {
71 "*:7080": {"pass": "routes"},
72 "*:7081": {"pass": "applications/mirror"},
73 },
74 "routes": [{"action": {"proxy": "http://127.0.0.1:7081"}}],
75 "applications": {

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

341 ), 'add ipv6 listener configure'
342
343 assert 'success' in self.conf(
344 [{"action": {"proxy": "http://[::1]:7081"}}], 'routes'
345 ), 'proxy ipv6 configure'
346
347 assert self.get_http10()['status'] == 200, 'status'
348
349 def test_proxy_unix(self):
350 addr = self.temp_dir + '/sock'
349 def test_proxy_unix(self, temp_dir):
350 addr = temp_dir + '/sock'
351
352 assert 'success' in self.conf(
353 {
354 "*:7080": {"pass": "routes"},
355 "unix:" + addr: {'application': 'mirror'},
356 },
357 'listeners',
358 ), 'add unix listener configure'

--- 154 unchanged lines hidden ---
351
352 assert 'success' in self.conf(
353 {
354 "*:7080": {"pass": "routes"},
355 "unix:" + addr: {'application': 'mirror'},
356 },
357 'listeners',
358 ), 'add unix listener configure'

--- 154 unchanged lines hidden ---