Tests: 8XXX used as default port range.
After the launch of the project, the testing infrastructure was shared with nginx project in some cases. To avoid port overlap, a decision was made to shift the port range for Unit tests. This problem was resolved a long time ago and is no longer relevant, so it is now safe to use port 8XXX range as the default, as it is more appropriate for testing purposes.
This commit is contained in:
@@ -15,11 +15,11 @@ def setup_method_fixture():
|
||||
def client_ip(options):
|
||||
assert 'success' in client.conf(
|
||||
{
|
||||
"127.0.0.1:7081": {
|
||||
"127.0.0.1:8081": {
|
||||
"client_ip": options,
|
||||
"pass": "applications/client_ip",
|
||||
},
|
||||
"[::1]:7082": {
|
||||
"[::1]:8082": {
|
||||
"client_ip": options,
|
||||
"pass": "applications/client_ip",
|
||||
},
|
||||
@@ -34,8 +34,8 @@ def client_ip(options):
|
||||
|
||||
def get_xff(xff, sock_type='ipv4'):
|
||||
address = {
|
||||
'ipv4': ('127.0.0.1', 7081),
|
||||
'ipv6': ('::1', 7082),
|
||||
'ipv4': ('127.0.0.1', 8081),
|
||||
'ipv6': ('::1', 8082),
|
||||
'unix': (f'{option.temp_dir}/sock', None),
|
||||
}
|
||||
(addr, port) = address[sock_type]
|
||||
@@ -51,9 +51,9 @@ def get_xff(xff, sock_type='ipv4'):
|
||||
def test_client_ip_single_ip():
|
||||
client_ip({'header': 'X-Forwarded-For', 'source': '123.123.123.123'})
|
||||
|
||||
assert client.get(port=7081)['body'] == '127.0.0.1', 'ipv4 default'
|
||||
assert client.get(port=8081)['body'] == '127.0.0.1', 'ipv4 default'
|
||||
assert (
|
||||
client.get(sock_type='ipv6', port=7082)['body'] == '::1'
|
||||
client.get(sock_type='ipv6', port=8082)['body'] == '::1'
|
||||
), 'ipv6 default'
|
||||
assert get_xff('1.1.1.1') == '127.0.0.1', 'bad source'
|
||||
assert get_xff('blah') == '127.0.0.1', 'bad header'
|
||||
@@ -61,9 +61,9 @@ def test_client_ip_single_ip():
|
||||
|
||||
client_ip({'header': 'X-Forwarded-For', 'source': '127.0.0.1'})
|
||||
|
||||
assert client.get(port=7081)['body'] == '127.0.0.1', 'ipv4 default 2'
|
||||
assert client.get(port=8081)['body'] == '127.0.0.1', 'ipv4 default 2'
|
||||
assert (
|
||||
client.get(sock_type='ipv6', port=7082)['body'] == '::1'
|
||||
client.get(sock_type='ipv6', port=8082)['body'] == '::1'
|
||||
), 'ipv6 default 2'
|
||||
assert get_xff('1.1.1.1') == '1.1.1.1', 'replace'
|
||||
assert get_xff('blah') == '127.0.0.1', 'bad header 2'
|
||||
@@ -159,7 +159,7 @@ def test_client_ip_empty_source():
|
||||
def test_client_ip_invalid():
|
||||
assert 'error' in client.conf(
|
||||
{
|
||||
"127.0.0.1:7081": {
|
||||
"127.0.0.1:8081": {
|
||||
"client_ip": {"source": '127.0.0.1'},
|
||||
"pass": "applications/client_ip",
|
||||
}
|
||||
@@ -170,7 +170,7 @@ def test_client_ip_invalid():
|
||||
def check_invalid_source(source):
|
||||
assert 'error' in client.conf(
|
||||
{
|
||||
"127.0.0.1:7081": {
|
||||
"127.0.0.1:8081": {
|
||||
"client_ip": {
|
||||
"header": "X-Forwarded-For",
|
||||
"source": source,
|
||||
|
||||
Reference in New Issue
Block a user