diff options
author | Andrei Zeliankou <zelenkov@nginx.com> | 2023-11-08 18:37:02 +0000 |
---|---|---|
committer | Andrei Zeliankou <zelenkov@nginx.com> | 2023-11-08 18:37:02 +0000 |
commit | 0b85fe29f7e49c88cab88aa9303d5885fa9c9dd5 (patch) | |
tree | 329ee87058eea8631596c802c23f39b78ad9446b /test | |
parent | 78c133d0ca3c343135e123a087970837afdebed1 (diff) | |
download | unit-0b85fe29f7e49c88cab88aa9303d5885fa9c9dd5.tar.gz unit-0b85fe29f7e49c88cab88aa9303d5885fa9c9dd5.tar.bz2 |
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.
Diffstat (limited to 'test')
101 files changed, 412 insertions, 412 deletions
diff --git a/test/go/404/app.go b/test/go/404/app.go index 7eba2cf4..255f5dac 100644 --- a/test/go/404/app.go +++ b/test/go/404/app.go @@ -18,5 +18,5 @@ func handler(w http.ResponseWriter, r *http.Request) { func main() { http.HandleFunc("/", handler) - unit.ListenAndServe(":7080", nil) + unit.ListenAndServe(":8080", nil) } diff --git a/test/go/command_line_arguments/app.go b/test/go/command_line_arguments/app.go index 1101e1cf..5da12ffe 100644 --- a/test/go/command_line_arguments/app.go +++ b/test/go/command_line_arguments/app.go @@ -19,5 +19,5 @@ func handler(w http.ResponseWriter, r *http.Request) { func main() { http.HandleFunc("/", handler) - unit.ListenAndServe(":7080", nil) + unit.ListenAndServe(":8080", nil) } diff --git a/test/go/cookies/app.go b/test/go/cookies/app.go index 2216e153..49779d35 100644 --- a/test/go/cookies/app.go +++ b/test/go/cookies/app.go @@ -15,5 +15,5 @@ func handler(w http.ResponseWriter, r *http.Request) { func main() { http.HandleFunc("/", handler) - unit.ListenAndServe(":7080", nil) + unit.ListenAndServe(":8080", nil) } diff --git a/test/go/empty/app.go b/test/go/empty/app.go index 9326a19b..61e27f67 100644 --- a/test/go/empty/app.go +++ b/test/go/empty/app.go @@ -9,5 +9,5 @@ func handler(w http.ResponseWriter, r *http.Request) {} func main() { http.HandleFunc("/", handler) - unit.ListenAndServe(":7080", nil) + unit.ListenAndServe(":8080", nil) } diff --git a/test/go/get_variables/app.go b/test/go/get_variables/app.go index 1c0205a8..d70669f2 100644 --- a/test/go/get_variables/app.go +++ b/test/go/get_variables/app.go @@ -13,5 +13,5 @@ func handler(w http.ResponseWriter, r *http.Request) { func main() { http.HandleFunc("/", handler) - unit.ListenAndServe(":7080", nil) + unit.ListenAndServe(":8080", nil) } diff --git a/test/go/mirror/app.go b/test/go/mirror/app.go index 78f047c3..daf55df8 100644 --- a/test/go/mirror/app.go +++ b/test/go/mirror/app.go @@ -17,5 +17,5 @@ func handler(w http.ResponseWriter, r *http.Request) { func main() { http.HandleFunc("/", handler) - unit.ListenAndServe(":7080", nil) + unit.ListenAndServe(":8080", nil) } diff --git a/test/go/ns_inspect/app.go b/test/go/ns_inspect/app.go index 570580e6..977f0d9c 100644 --- a/test/go/ns_inspect/app.go +++ b/test/go/ns_inspect/app.go @@ -97,5 +97,5 @@ func handler(w http.ResponseWriter, r *http.Request) { func main() { http.HandleFunc("/", handler) - unit.ListenAndServe(":7080", nil) + unit.ListenAndServe(":8080", nil) } diff --git a/test/go/post_variables/app.go b/test/go/post_variables/app.go index e6279ac6..06900d4c 100644 --- a/test/go/post_variables/app.go +++ b/test/go/post_variables/app.go @@ -15,5 +15,5 @@ func handler(w http.ResponseWriter, r *http.Request) { func main() { http.HandleFunc("/", handler) - unit.ListenAndServe(":7080", nil) + unit.ListenAndServe(":8080", nil) } diff --git a/test/go/variables/app.go b/test/go/variables/app.go index 4be60cb7..9ef18aae 100644 --- a/test/go/variables/app.go +++ b/test/go/variables/app.go @@ -26,5 +26,5 @@ func handler(w http.ResponseWriter, r *http.Request) { func main() { http.HandleFunc("/", handler) - unit.ListenAndServe(":7080", nil) + unit.ListenAndServe(":8080", nil) } diff --git a/test/node/404/app.js b/test/node/404/app.js index ba15c104..8beec34a 100644 --- a/test/node/404/app.js +++ b/test/node/404/app.js @@ -3,4 +3,4 @@ var fs = require('fs'); require('http').createServer(function (req, res) { res.writeHead(404, {}).end(fs.readFileSync('404.html')); -}).listen(7080); +}).listen(8080); diff --git a/test/node/basic/app.js b/test/node/basic/app.js index 9092022c..2d870003 100644 --- a/test/node/basic/app.js +++ b/test/node/basic/app.js @@ -2,4 +2,4 @@ require('http').createServer(function (req, res) { res.writeHead(200, {'Content-Length': 12, 'Content-Type': 'text/plain'}) .end('Hello World\n'); -}).listen(7080); +}).listen(8080); diff --git a/test/node/double_end/app.js b/test/node/double_end/app.js index 653e33b1..e721db77 100644 --- a/test/node/double_end/app.js +++ b/test/node/double_end/app.js @@ -1,4 +1,4 @@ require('http').createServer(function (req, res) { res.end().end(); -}).listen(7080); +}).listen(8080); diff --git a/test/node/get_header_names/app.js b/test/node/get_header_names/app.js index a938b762..77aa0327 100644 --- a/test/node/get_header_names/app.js +++ b/test/node/get_header_names/app.js @@ -4,4 +4,4 @@ require('http').createServer(function (req, res) { res.setHeader('X-Header', 'blah'); res.setHeader('X-Names', res.getHeaderNames()); res.end(); -}).listen(7080); +}).listen(8080); diff --git a/test/node/get_header_type/app.js b/test/node/get_header_type/app.js index 6e45b71f..d5a591e8 100644 --- a/test/node/get_header_type/app.js +++ b/test/node/get_header_type/app.js @@ -3,4 +3,4 @@ require('http').createServer(function (req, res) { res.setHeader('X-Number', 100); res.setHeader('X-Type', typeof(res.getHeader('X-Number'))); res.end(); -}).listen(7080); +}).listen(8080); diff --git a/test/node/get_variables/app.js b/test/node/get_variables/app.js index cded43d2..8f317cb4 100644 --- a/test/node/get_variables/app.js +++ b/test/node/get_variables/app.js @@ -5,4 +5,4 @@ require('http').createServer(function (req, res) { res.setHeader('X-Var-2', query.var2); res.setHeader('X-Var-3', query.var3); res.end(); -}).listen(7080); +}).listen(8080); diff --git a/test/node/has_header/app.js b/test/node/has_header/app.js index 04b13916..30e75e4d 100644 --- a/test/node/has_header/app.js +++ b/test/node/has_header/app.js @@ -2,4 +2,4 @@ require('http').createServer(function (req, res) { res.setHeader('X-Has-Header', res.hasHeader(req.headers['x-header']) + ''); res.end(); -}).listen(7080); +}).listen(8080); diff --git a/test/node/header_name_case/app.js b/test/node/header_name_case/app.js index af157547..45acd507 100644 --- a/test/node/header_name_case/app.js +++ b/test/node/header_name_case/app.js @@ -4,4 +4,4 @@ require('http').createServer(function (req, res) { res.setHeader('X-header', '2'); res.setHeader('X-HEADER', '3'); res.end(); -}).listen(7080); +}).listen(8080); diff --git a/test/node/header_name_valid/app.js b/test/node/header_name_valid/app.js index c0c36098..9ac0c3a2 100644 --- a/test/node/header_name_valid/app.js +++ b/test/node/header_name_valid/app.js @@ -3,4 +3,4 @@ require('http').createServer(function (req, res) { res.writeHead(200, {}); res.setHeader('@$', 'test'); res.end(); -}).listen(7080); +}).listen(8080); diff --git a/test/node/header_value_object/app.js b/test/node/header_value_object/app.js index bacdc7d5..6f3d74bc 100644 --- a/test/node/header_value_object/app.js +++ b/test/node/header_value_object/app.js @@ -2,4 +2,4 @@ require('http').createServer(function (req, res) { res.setHeader('X-Header', {}); res.end(); -}).listen(7080); +}).listen(8080); diff --git a/test/node/loader/es_modules_http/app.mjs b/test/node/loader/es_modules_http/app.mjs index c7bcfe49..28ff08d8 100644 --- a/test/node/loader/es_modules_http/app.mjs +++ b/test/node/loader/es_modules_http/app.mjs @@ -3,4 +3,4 @@ import http from "http" http.createServer(function (req, res) { res.writeHead(200, {'Content-Length': 12, 'Content-Type': 'text/plain'}) .end('Hello World\n'); -}).listen(7080); +}).listen(8080); diff --git a/test/node/loader/es_modules_http_indirect/module.mjs b/test/node/loader/es_modules_http_indirect/module.mjs index c7bcfe49..28ff08d8 100644 --- a/test/node/loader/es_modules_http_indirect/module.mjs +++ b/test/node/loader/es_modules_http_indirect/module.mjs @@ -3,4 +3,4 @@ import http from "http" http.createServer(function (req, res) { res.writeHead(200, {'Content-Length': 12, 'Content-Type': 'text/plain'}) .end('Hello World\n'); -}).listen(7080); +}).listen(8080); diff --git a/test/node/loader/es_modules_websocket/app.mjs b/test/node/loader/es_modules_websocket/app.mjs index a71ffa9d..361d855b 100644 --- a/test/node/loader/es_modules_websocket/app.mjs +++ b/test/node/loader/es_modules_websocket/app.mjs @@ -4,7 +4,7 @@ import websocket from "websocket" let server = http.createServer(function() {}); let webSocketServer = websocket.server; -server.listen(7080, function() {}); +server.listen(8080, function() {}); var wsServer = new webSocketServer({ maxReceivedMessageSize: 0x1000000000, diff --git a/test/node/loader/es_modules_websocket_indirect/module.mjs b/test/node/loader/es_modules_websocket_indirect/module.mjs index a71ffa9d..361d855b 100644 --- a/test/node/loader/es_modules_websocket_indirect/module.mjs +++ b/test/node/loader/es_modules_websocket_indirect/module.mjs @@ -4,7 +4,7 @@ import websocket from "websocket" let server = http.createServer(function() {}); let webSocketServer = websocket.server; -server.listen(7080, function() {}); +server.listen(8080, function() {}); var wsServer = new webSocketServer({ maxReceivedMessageSize: 0x1000000000, diff --git a/test/node/loader/transitive_dependency/transitive_http.js b/test/node/loader/transitive_dependency/transitive_http.js index f1eb98e5..171758ed 100644 --- a/test/node/loader/transitive_dependency/transitive_http.js +++ b/test/node/loader/transitive_dependency/transitive_http.js @@ -3,6 +3,6 @@ const http = require("http"); http.createServer(function (req, res) { res.writeHead(200, {'Content-Length': 12, 'Content-Type': 'text/plain'}) .end('Hello World\n'); -}).listen(7080); +}).listen(8080); module.exports = http; diff --git a/test/node/loader/unit_http/app.js b/test/node/loader/unit_http/app.js index 9172e44f..0e0c2b24 100644 --- a/test/node/loader/unit_http/app.js +++ b/test/node/loader/unit_http/app.js @@ -1,4 +1,4 @@ require("unit-http").createServer(function (req, res) { res.writeHead(200, {'Content-Length': 12, 'Content-Type': 'text/plain'}) .end('Hello World\n'); -}).listen(7080); +}).listen(8080); diff --git a/test/node/mirror/app.js b/test/node/mirror/app.js index bdefe1cd..bdb89489 100644 --- a/test/node/mirror/app.js +++ b/test/node/mirror/app.js @@ -8,4 +8,4 @@ require('http').createServer(function (req, res) { res.writeHead(200, {'Content-Length': Buffer.byteLength(body)}) .end(body); }); -}).listen(7080); +}).listen(8080); diff --git a/test/node/post_variables/app.js b/test/node/post_variables/app.js index 12b867cb..4d88434d 100644 --- a/test/node/post_variables/app.js +++ b/test/node/post_variables/app.js @@ -11,4 +11,4 @@ require('http').createServer(function (req, res) { res.setHeader('X-Var-3', query.var3); res.end(); }); -}).listen(7080); +}).listen(8080); diff --git a/test/node/promise_end/app.js b/test/node/promise_end/app.js index 373c3bc6..75c2ef7d 100644 --- a/test/node/promise_end/app.js +++ b/test/node/promise_end/app.js @@ -12,4 +12,4 @@ require('http').createServer(function (req, res) { fs.appendFile('callback', '', function() {}); }); -}).listen(7080); +}).listen(8080); diff --git a/test/node/promise_handler/app.js b/test/node/promise_handler/app.js index 32d7d7b9..7bcb1ae9 100644 --- a/test/node/promise_handler/app.js +++ b/test/node/promise_handler/app.js @@ -13,4 +13,4 @@ require('http').createServer(function (req, res) { fs.appendFile(data.toString(), '', function() {}); }); }); -}).listen(7080); +}).listen(8080); diff --git a/test/node/remove_header/app.js b/test/node/remove_header/app.js index 2a591235..877a7351 100644 --- a/test/node/remove_header/app.js +++ b/test/node/remove_header/app.js @@ -7,4 +7,4 @@ require('http').createServer(function (req, res) { res.setHeader('Has-Header', res.hasHeader('X-Header').toString()); res.end(); -}).listen(7080); +}).listen(8080); diff --git a/test/node/set_header_array/app.js b/test/node/set_header_array/app.js index 965330e2..0dee477e 100644 --- a/test/node/set_header_array/app.js +++ b/test/node/set_header_array/app.js @@ -2,4 +2,4 @@ require('http').createServer(function (req, res) { res.setHeader('Set-Cookie', ['tc=one,two,three', 'tc=four,five,six']); res.end(); -}).listen(7080); +}).listen(8080); diff --git a/test/node/status_message/app.js b/test/node/status_message/app.js index ba51d35b..53eea5c7 100644 --- a/test/node/status_message/app.js +++ b/test/node/status_message/app.js @@ -1,4 +1,4 @@ require('http').createServer(function (req, res) { res.writeHead(200, 'blah', {'Content-Type': 'text/plain'}).end(); -}).listen(7080); +}).listen(8080); diff --git a/test/node/update_header/app.js b/test/node/update_header/app.js index 905ac294..dc3415e6 100644 --- a/test/node/update_header/app.js +++ b/test/node/update_header/app.js @@ -3,4 +3,4 @@ require('http').createServer(function (req, res) { res.setHeader('X-Header', 'test'); res.setHeader('X-Header', 'new'); res.end(); -}).listen(7080); +}).listen(8080); diff --git a/test/node/variables/app.js b/test/node/variables/app.js index a569dddd..b6f36f37 100644 --- a/test/node/variables/app.js +++ b/test/node/variables/app.js @@ -15,4 +15,4 @@ require('http').createServer(function (req, res) { res.setHeader('Http-Host', req.headers['host']); res.writeHead(200, {}).end(body); }); -}).listen(7080); +}).listen(8080); diff --git a/test/node/websockets/mirror/app.js b/test/node/websockets/mirror/app.js index 0443adb2..ee2bdd18 100644 --- a/test/node/websockets/mirror/app.js +++ b/test/node/websockets/mirror/app.js @@ -2,7 +2,7 @@ server = require('http').createServer(function() {}); webSocketServer = require('websocket').server; -server.listen(7080, function() {}); +server.listen(8080, function() {}); var wsServer = new webSocketServer({ maxReceivedMessageSize: 0x1000000000, diff --git a/test/node/websockets/mirror_fragmentation/app.js b/test/node/websockets/mirror_fragmentation/app.js index ea580ac2..ca539ad6 100644 --- a/test/node/websockets/mirror_fragmentation/app.js +++ b/test/node/websockets/mirror_fragmentation/app.js @@ -2,7 +2,7 @@ server = require('http').createServer(function() {}); webSocketServer = require('websocket').server; -server.listen(7080, function() {}); +server.listen(8080, function() {}); var wsServer = new webSocketServer({ httpServer: server diff --git a/test/node/write_array/app.js b/test/node/write_array/app.js index b7abb3fc..761e8537 100644 --- a/test/node/write_array/app.js +++ b/test/node/write_array/app.js @@ -1,4 +1,4 @@ require('http').createServer(function (req, res) { res.writeHead(200, {'Content-Length': 5, 'Content-Type': 'text/plain'}) .end(new Uint8Array(Buffer.from('array', 'utf8'))); -}).listen(7080); +}).listen(8080); diff --git a/test/node/write_before_write_head/app.js b/test/node/write_before_write_head/app.js index 2293111a..10c8b9d6 100644 --- a/test/node/write_before_write_head/app.js +++ b/test/node/write_before_write_head/app.js @@ -2,4 +2,4 @@ require('http').createServer(function (req, res) { res.write('blah'); res.writeHead(200, {'Content-Type': 'text/plain'}).end(); -}).listen(7080); +}).listen(8080); diff --git a/test/node/write_buffer/app.js b/test/node/write_buffer/app.js index 72e9c600..24585ef2 100644 --- a/test/node/write_buffer/app.js +++ b/test/node/write_buffer/app.js @@ -2,4 +2,4 @@ require('http').createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}) .end(Buffer.from('buffer', 'utf8')); -}).listen(7080); +}).listen(8080); diff --git a/test/node/write_callback/app.js b/test/node/write_callback/app.js index 71eb4116..f03cb213 100644 --- a/test/node/write_callback/app.js +++ b/test/node/write_callback/app.js @@ -9,4 +9,4 @@ require('http').createServer(function (req, res) { fs.appendFile('callback', '', function() {}); }); res.end(a); -}).listen(7080); +}).listen(8080); diff --git a/test/node/write_multiple/app.js b/test/node/write_multiple/app.js index e9c51ae0..b1e485e7 100644 --- a/test/node/write_multiple/app.js +++ b/test/node/write_multiple/app.js @@ -4,4 +4,4 @@ require('http').createServer(function (req, res) { res.write('write'); res.write('write2'); res.end('end'); -}).listen(7080); +}).listen(8080); diff --git a/test/node/write_return/app.js b/test/node/write_return/app.js index 345b6c4b..d0b3d850 100644 --- a/test/node/write_return/app.js +++ b/test/node/write_return/app.js @@ -2,4 +2,4 @@ require('http').createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}) .end(res.write('body').toString()); -}).listen(7080); +}).listen(8080); diff --git a/test/test_access_log.py b/test/test_access_log.py index bccea56f..3c5e6cbb 100644 --- a/test/test_access_log.py +++ b/test/test_access_log.py @@ -93,7 +93,7 @@ def test_access_log_ipv6(wait_for_record): load('empty') assert 'success' in client.conf( - {"[::1]:7080": {"pass": "applications/empty"}}, 'listeners' + {"[::1]:8080": {"pass": "applications/empty"}}, 'listeners' ) client.get(sock_type='ipv6') diff --git a/test/test_asgi_application.py b/test/test_asgi_application.py index 98d4bcd5..4b59fafd 100644 --- a/test/test_asgi_application.py +++ b/test/test_asgi_application.py @@ -60,7 +60,7 @@ def test_asgi_application_ipv6(): client.load('empty') assert 'success' in client.conf( - {"[::1]:7080": {"pass": "applications/empty"}}, 'listeners' + {"[::1]:8080": {"pass": "applications/empty"}}, 'listeners' ) assert client.get(sock_type='ipv6')['status'] == 200 @@ -172,7 +172,7 @@ def test_asgi_application_server_port(): client.load('server_port') assert ( - client.get()['headers']['Server-Port'] == '7080' + client.get()['headers']['Server-Port'] == '8080' ), 'Server-Port header' diff --git a/test/test_asgi_lifespan.py b/test/test_asgi_lifespan.py index 499f523d..5df7475e 100644 --- a/test/test_asgi_lifespan.py +++ b/test/test_asgi_lifespan.py @@ -59,7 +59,7 @@ def test_asgi_lifespan_targets(): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "routes"}}, + "listeners": {"*:8080": {"pass": "routes"}}, "routes": [ { "match": {"uri": "/1"}, diff --git a/test/test_asgi_targets.py b/test/test_asgi_targets.py index c3ec22f0..63bde713 100644 --- a/test/test_asgi_targets.py +++ b/test/test_asgi_targets.py @@ -16,7 +16,7 @@ def setup_method_fixture(): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "routes"}}, + "listeners": {"*:8080": {"pass": "routes"}}, "routes": [ { "match": {"uri": "/1"}, diff --git a/test/test_client_ip.py b/test/test_client_ip.py index 82c76718..d7bc399d 100644 --- a/test/test_client_ip.py +++ b/test/test_client_ip.py @@ -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, diff --git a/test/test_configuration.py b/test/test_configuration.py index 19a2a1a5..a311922f 100644 --- a/test/test_configuration.py +++ b/test/test_configuration.py @@ -234,12 +234,12 @@ def test_applications_relative_path(): @pytest.mark.skip('not yet, unsafe') def test_listeners_empty(): - assert 'error' in client.conf({"*:7080": {}}, 'listeners'), 'listener empty' + assert 'error' in client.conf({"*:8080": {}}, 'listeners'), 'listener empty' def test_listeners_no_app(): assert 'error' in client.conf( - {"*:7080": {"pass": "applications/app"}}, 'listeners' + {"*:8080": {"pass": "applications/app"}}, 'listeners' ), 'listeners no app' @@ -254,9 +254,9 @@ def test_listeners_unix_abstract(system): def test_listeners_addr(): - assert 'success' in try_addr("*:7080"), 'wildcard' - assert 'success' in try_addr("127.0.0.1:7081"), 'explicit' - assert 'success' in try_addr("[::1]:7082"), 'explicit ipv6' + assert 'success' in try_addr("*:8080"), 'wildcard' + assert 'success' in try_addr("127.0.0.1:8081"), 'explicit' + assert 'success' in try_addr("[::1]:8082"), 'explicit ipv6' def test_listeners_addr_error(): @@ -266,7 +266,7 @@ def test_listeners_addr_error(): def test_listeners_addr_error_2(skip_alert): skip_alert(r'bind.*failed', r'failed to apply new conf') - assert 'error' in try_addr("[f607:7403:1e4b:6c66:33b2:843f:2517:da27]:7080") + assert 'error' in try_addr("[f607:7403:1e4b:6c66:33b2:843f:2517:da27]:8080") def test_listeners_port_release(): @@ -277,7 +277,7 @@ def test_listeners_port_release(): client.conf( { - "listeners": {"127.0.0.1:7080": {"pass": "routes"}}, + "listeners": {"127.0.0.1:8080": {"pass": "routes"}}, "routes": [], } ) @@ -285,7 +285,7 @@ def test_listeners_port_release(): resp = client.conf({"listeners": {}, "applications": {}}) try: - s.bind(('127.0.0.1', 7080)) + s.bind(('127.0.0.1', 8080)) s.listen() except OSError: @@ -302,7 +302,7 @@ def test_json_application_name_large(): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": f"applications/{name}"}}, + "listeners": {"*:8080": {"pass": f"applications/{name}"}}, "applications": { name: { "type": "python", @@ -349,7 +349,7 @@ def test_json_application_python_prefix(): "prefix": "/app", } }, - "listeners": {"*:7080": {"pass": "routes"}}, + "listeners": {"*:8080": {"pass": "routes"}}, "routes": [ { "match": {"uri": "/app/*"}, @@ -378,7 +378,7 @@ def test_json_application_prefix_target(): }, } }, - "listeners": {"*:7080": {"pass": "routes"}}, + "listeners": {"*:8080": {"pass": "routes"}}, "routes": [ { "match": {"uri": "/app/*"}, @@ -405,7 +405,7 @@ def test_json_application_invalid_python_prefix(): "prefix": "app", } }, - "listeners": {"*:7080": {"pass": "applications/sub-app"}}, + "listeners": {"*:8080": {"pass": "applications/sub-app"}}, } assert 'error' in client.conf(conf) @@ -422,7 +422,7 @@ def test_json_application_empty_python_prefix(): "prefix": "", } }, - "listeners": {"*:7080": {"pass": "applications/sub-app"}}, + "listeners": {"*:8080": {"pass": "applications/sub-app"}}, } assert 'error' in client.conf(conf) @@ -441,7 +441,7 @@ def test_json_application_many2(): # open files limit due to the lack of file descriptors. for a in range(100) }, - "listeners": {"*:7080": {"pass": "applications/app-1"}}, + "listeners": {"*:8080": {"pass": "applications/app-1"}}, } assert 'success' in client.conf(conf) diff --git a/test/test_forwarded_header.py b/test/test_forwarded_header.py index c3f4a4c6..eaa83dce 100644 --- a/test/test_forwarded_header.py +++ b/test/test_forwarded_header.py @@ -14,11 +14,11 @@ def setup_method_fixture(): def forwarded_header(forwarded): assert 'success' in client.conf( { - "127.0.0.1:7081": { + "127.0.0.1:8081": { "forwarded": forwarded, "pass": "applications/forwarded_header", }, - "[::1]:7082": { + "[::1]:8082": { "forwarded": forwarded, "pass": "applications/forwarded_header", }, @@ -28,7 +28,7 @@ def forwarded_header(forwarded): def get_fwd(sock_type='ipv4', xff=None, xfp=None): - port = 7081 if sock_type == 'ipv4' else 7082 + port = 8081 if sock_type == 'ipv4' else 8082 headers = {'Connection': 'close'} @@ -243,7 +243,7 @@ def test_forwarded_header_source_range(): def test_forwarded_header_invalid(): assert 'error' in client.conf( { - "127.0.0.1:7081": { + "127.0.0.1:8081": { "forwarded": {"source": '127.0.0.1'}, "pass": "applications/forwarded_header", } @@ -254,7 +254,7 @@ def test_forwarded_header_invalid(): def check_invalid_source(source): assert 'error' in client.conf( { - "127.0.0.1:7081": { + "127.0.0.1:8081": { "forwarded": { "client_ip": "X-Forwarded-For", "source": source, diff --git a/test/test_http_header.py b/test/test_http_header.py index af836e6f..cf5866e9 100644 --- a/test/test_http_header.py +++ b/test/test_http_header.py @@ -333,7 +333,7 @@ def test_http_header_host_port(): client.load('host') resp = client.get( - headers={'Host': 'exmaple.com:7080', 'Connection': 'close'} + headers={'Host': 'exmaple.com:8080', 'Connection': 'close'} ) assert resp['status'] == 200, 'Host port status' @@ -341,7 +341,7 @@ def test_http_header_host_port(): resp['headers']['X-Server-Name'] == 'exmaple.com' ), 'Host port SERVER_NAME' assert ( - resp['headers']['X-Http-Host'] == 'exmaple.com:7080' + resp['headers']['X-Http-Host'] == 'exmaple.com:8080' ), 'Host port HTTP_HOST' @@ -373,14 +373,14 @@ def test_http_header_host_literal(): def test_http_header_host_literal_ipv6(): client.load('host') - resp = client.get(headers={'Host': '[::1]:7080', 'Connection': 'close'}) + resp = client.get(headers={'Host': '[::1]:8080', 'Connection': 'close'}) assert resp['status'] == 200, 'Host literal ipv6 status' assert ( resp['headers']['X-Server-Name'] == '[::1]' ), 'Host literal ipv6 SERVER_NAME' assert ( - resp['headers']['X-Http-Host'] == '[::1]:7080' + resp['headers']['X-Http-Host'] == '[::1]:8080' ), 'Host literal ipv6 HTTP_HOST' diff --git a/test/test_java_application.py b/test/test_java_application.py index eefc5c79..3a6a62d6 100644 --- a/test/test_java_application.py +++ b/test/test_java_application.py @@ -20,7 +20,7 @@ def test_java_conf_error(temp_dir, skip_alert): ) assert 'error' in client.conf( { - "listeners": {"*:7080": {"pass": "applications/app"}}, + "listeners": {"*:8080": {"pass": "applications/app"}}, "applications": { "app": { "type": client.get_application_type(), diff --git a/test/test_njs.py b/test/test_njs.py index 162cc0bd..ce92e1ef 100644 --- a/test/test_njs.py +++ b/test/test_njs.py @@ -14,7 +14,7 @@ client = ApplicationProto() def setup_method_fixture(temp_dir): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "routes"}}, + "listeners": {"*:8080": {"pass": "routes"}}, "routes": [{"action": {"share": f"{temp_dir}/assets$uri"}}], } ) diff --git a/test/test_njs_modules.py b/test/test_njs_modules.py index d821d455..a639fabd 100644 --- a/test/test_njs_modules.py +++ b/test/test_njs_modules.py @@ -23,7 +23,7 @@ def test_njs_modules(): assert 'success' in client.conf( { "settings": {"js_module": "next"}, - "listeners": {"*:7080": {"pass": "routes/first"}}, + "listeners": {"*:8080": {"pass": "routes/first"}}, "routes": { "first": [{"action": {"pass": "`routes/${next.route()}`"}}], "next": [{"action": {"return": 200}}], @@ -68,7 +68,7 @@ def test_njs_modules_import(): assert 'success' in client.conf( { "settings": {"js_module": "import_from"}, - "listeners": {"*:7080": {"pass": "routes/first"}}, + "listeners": {"*:8080": {"pass": "routes/first"}}, "routes": { "first": [ {"action": {"pass": "`routes/${import_from.num()}`"}} @@ -86,7 +86,7 @@ def test_njs_modules_this(): assert 'success' in client.conf( { "settings": {"js_module": "global_this"}, - "listeners": {"*:7080": {"pass": "routes/first"}}, + "listeners": {"*:8080": {"pass": "routes/first"}}, "routes": { "first": [ {"action": {"pass": "`routes/${global_this.str()}`"}} diff --git a/test/test_perl_application.py b/test/test_perl_application.py index 7e6571fb..115b0ec7 100644 --- a/test/test_perl_application.py +++ b/test/test_perl_application.py @@ -88,7 +88,7 @@ def test_perl_application_server_port(): client.load('server_port') assert ( - client.get()['headers']['Server-Port'] == '7080' + client.get()['headers']['Server-Port'] == '8080' ), 'Server-Port header' diff --git a/test/test_php_application.py b/test/test_php_application.py index 17440909..8a6641cb 100644 --- a/test/test_php_application.py +++ b/test/test_php_application.py @@ -174,7 +174,7 @@ def test_php_application_query_string_empty(): def test_php_application_query_string_rewrite(): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "routes"}}, + "listeners": {"*:8080": {"pass": "routes"}}, "routes": [ { "action": { @@ -678,7 +678,7 @@ def test_php_application_error_log(findall, wait_for_record): def test_php_application_script(): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "applications/script"}}, + "listeners": {"*:8080": {"pass": "applications/script"}}, "applications": { "script": { "type": client.get_application_type(), @@ -699,7 +699,7 @@ def test_php_application_script(): def test_php_application_index_default(): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "applications/phpinfo"}}, + "listeners": {"*:8080": {"pass": "applications/phpinfo"}}, "applications": { "phpinfo": { "type": client.get_application_type(), @@ -727,7 +727,7 @@ def test_php_application_trailing_slash(temp_dir): assert 'success' in client.conf( { "listeners": { - "*:7080": {"pass": "applications/php-path"}, + "*:8080": {"pass": "applications/php-path"}, f'unix:{addr}': {"pass": "applications/php-path"}, }, "applications": { @@ -745,7 +745,7 @@ def test_php_application_trailing_slash(temp_dir): resp = client.get(url='/path?q=a') assert resp['status'] == 301, 'uri without trailing /' assert ( - resp['headers']['Location'] == 'http://localhost:7080/path/?q=a' + resp['headers']['Location'] == 'http://localhost:8080/path/?q=a' ), 'Location with query string' resp = client.get( @@ -767,7 +767,7 @@ def test_php_application_forbidden(temp_dir): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "applications/php-path"}}, + "listeners": {"*:8080": {"pass": "applications/php-path"}}, "applications": { "php-path": { "type": client.get_application_type(), @@ -792,7 +792,7 @@ def test_php_application_extension_check(temp_dir): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "applications/phpinfo"}}, + "listeners": {"*:8080": {"pass": "applications/phpinfo"}}, "applications": { "phpinfo": { "type": client.get_application_type(), diff --git a/test/test_php_basic.py b/test/test_php_basic.py index 64754961..076b7498 100644 --- a/test/test_php_basic.py +++ b/test/test_php_basic.py @@ -14,7 +14,7 @@ conf_app = { } conf_basic = { - "listeners": {"*:7080": {"pass": "applications/app"}}, + "listeners": {"*:8080": {"pass": "applications/app"}}, "applications": conf_app, } @@ -60,14 +60,14 @@ def test_php_get_listeners(): assert 'success' in client.conf(conf_basic) assert client.conf_get()['listeners'] == { - "*:7080": {"pass": "applications/app"} + "*:8080": {"pass": "applications/app"} }, 'listeners' assert client.conf_get('listeners') == { - "*:7080": {"pass": "applications/app"} + "*:8080": {"pass": "applications/app"} }, 'listeners prefix' - assert client.conf_get('listeners/*:7080') == { + assert client.conf_get('listeners/*:8080') == { "pass": "applications/app" }, 'listeners prefix 2' @@ -75,23 +75,23 @@ def test_php_get_listeners(): def test_php_change_listener(): assert 'success' in client.conf(conf_basic) assert 'success' in client.conf( - {"*:7081": {"pass": "applications/app"}}, 'listeners' + {"*:8081": {"pass": "applications/app"}}, 'listeners' ) assert client.conf_get('listeners') == { - "*:7081": {"pass": "applications/app"} + "*:8081": {"pass": "applications/app"} }, 'change listener' def test_php_add_listener(): assert 'success' in client.conf(conf_basic) assert 'success' in client.conf( - {"pass": "applications/app"}, 'listeners/*:7082' + {"pass": "applications/app"}, 'listeners/*:8082' ) assert client.conf_get('listeners') == { - "*:7080": {"pass": "applications/app"}, - "*:7082": {"pass": "applications/app"}, + "*:8080": {"pass": "applications/app"}, + "*:8082": {"pass": "applications/app"}, }, 'add listener' @@ -113,7 +113,7 @@ def test_php_delete(): assert 'success' in client.conf(conf_basic) assert 'error' in client.conf_delete('applications/app') - assert 'success' in client.conf_delete('listeners/*:7080') + assert 'success' in client.conf_delete('listeners/*:8080') assert 'success' in client.conf_delete('applications/app') assert 'error' in client.conf_delete('applications/app') @@ -126,5 +126,5 @@ def test_php_delete_blocks(): assert 'success' in client.conf(conf_app, 'applications') assert 'success' in client.conf( - {"*:7081": {"pass": "applications/app"}}, 'listeners' + {"*:8081": {"pass": "applications/app"}}, 'listeners' ), 'applications restore' diff --git a/test/test_php_targets.py b/test/test_php_targets.py index 857a2dc8..6085db40 100644 --- a/test/test_php_targets.py +++ b/test/test_php_targets.py @@ -10,7 +10,7 @@ def test_php_application_targets(): targets_dir = f"{option.test_dir}/php/targets" assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "routes"}}, + "listeners": {"*:8080": {"pass": "routes"}}, "routes": [ { "match": {"uri": "/1"}, @@ -65,7 +65,7 @@ def test_php_application_targets(): def test_php_application_targets_error(): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "applications/targets/default"}}, + "listeners": {"*:8080": {"pass": "applications/targets/default"}}, "applications": { "targets": { "type": client.get_application_type(), @@ -83,7 +83,7 @@ def test_php_application_targets_error(): assert client.get()['status'] == 200 assert 'error' in client.conf( - {"pass": "applications/targets/blah"}, 'listeners/*:7080' + {"pass": "applications/targets/blah"}, 'listeners/*:8080' ), 'invalid targets pass' assert 'error' in client.conf( f'"{option.test_dir}/php/targets"', diff --git a/test/test_proxy.py b/test/test_proxy.py index 207e90e7..b64e19db 100644 --- a/test/test_proxy.py +++ b/test/test_proxy.py @@ -23,10 +23,10 @@ def setup_method_fixture(): assert 'success' in client.conf( { "listeners": { - "*:7080": {"pass": "routes"}, - "*:7081": {"pass": "applications/mirror"}, + "*:8080": {"pass": "routes"}, + "*:8081": {"pass": "applications/mirror"}, }, - "routes": [{"action": {"proxy": "http://127.0.0.1:7081"}}], + "routes": [{"action": {"proxy": "http://127.0.0.1:8081"}}], "applications": { "mirror": { "type": client.get_application_type(), @@ -110,19 +110,19 @@ def test_proxy_chain(): assert 'success' in client.conf( { "listeners": { - "*:7080": {"pass": "routes/first"}, - "*:7081": {"pass": "routes/second"}, - "*:7082": {"pass": "routes/third"}, - "*:7083": {"pass": "routes/fourth"}, - "*:7084": {"pass": "routes/fifth"}, - "*:7085": {"pass": "applications/mirror"}, + "*:8080": {"pass": "routes/first"}, + "*:8081": {"pass": "routes/second"}, + "*:8082": {"pass": "routes/third"}, + "*:8083": {"pass": "routes/fourth"}, + "*:8084": {"pass": "routes/fifth"}, + "*:8085": {"pass": "applications/mirror"}, }, "routes": { - "first": [{"action": {"proxy": "http://127.0.0.1:7081"}}], - "second": [{"action": {"proxy": "http://127.0.0.1:7082"}}], - "third": [{"action": {"proxy": "http://127.0.0.1:7083"}}], - "fourth": [{"action": {"proxy": "http://127.0.0.1:7084"}}], - "fifth": [{"action": {"proxy": "http://127.0.0.1:7085"}}], + "first": [{"action": {"proxy": "http://127.0.0.1:8081"}}], + "second": [{"action": {"proxy": "http://127.0.0.1:8082"}}], + "third": [{"action": {"proxy": "http://127.0.0.1:8083"}}], + "fourth": [{"action": {"proxy": "http://127.0.0.1:8084"}}], + "fifth": [{"action": {"proxy": "http://127.0.0.1:8085"}}], }, "applications": { "mirror": { @@ -210,7 +210,7 @@ def test_proxy_parallel(): def test_proxy_header(): assert 'success' in client.conf( - {"pass": "applications/custom_header"}, 'listeners/*:7081' + {"pass": "applications/custom_header"}, 'listeners/*:8081' ), 'custom_header configure' header_value = 'blah' @@ -325,7 +325,7 @@ def test_proxy_fragmented_body_close(): def test_proxy_nowhere(): assert 'success' in client.conf( - [{"action": {"proxy": "http://127.0.0.1:7082"}}], 'routes' + [{"action": {"proxy": "http://127.0.0.1:8082"}}], 'routes' ), 'proxy path changed' assert get_http10()['status'] == 502, 'status' @@ -334,14 +334,14 @@ def test_proxy_nowhere(): def test_proxy_ipv6(): assert 'success' in client.conf( { - "*:7080": {"pass": "routes"}, - "[::1]:7081": {'application': 'mirror'}, + "*:8080": {"pass": "routes"}, + "[::1]:8081": {'application': 'mirror'}, }, 'listeners', ), 'add ipv6 listener configure' assert 'success' in client.conf( - [{"action": {"proxy": "http://[::1]:7081"}}], 'routes' + [{"action": {"proxy": "http://[::1]:8081"}}], 'routes' ), 'proxy ipv6 configure' assert get_http10()['status'] == 200, 'status' @@ -352,7 +352,7 @@ def test_proxy_unix(temp_dir): assert 'success' in client.conf( { - "*:7080": {"pass": "routes"}, + "*:8080": {"pass": "routes"}, f'unix:{addr}': {'application': 'mirror'}, }, 'listeners', @@ -367,7 +367,7 @@ def test_proxy_unix(temp_dir): def test_proxy_delayed(): assert 'success' in client.conf( - {"pass": "applications/delayed"}, 'listeners/*:7081' + {"pass": "applications/delayed"}, 'listeners/*:8081' ), 'delayed configure' body = '0123456789' * 1000 @@ -400,7 +400,7 @@ def test_proxy_delayed(): def test_proxy_delayed_close(): assert 'success' in client.conf( - {"pass": "applications/delayed"}, 'listeners/*:7081' + {"pass": "applications/delayed"}, 'listeners/*:8081' ), 'delayed configure' sock = post_http10( @@ -469,11 +469,11 @@ def test_proxy_invalid(): check_proxy('http://127.0.0.1:') check_proxy('http://127.0.0.1:blah') check_proxy('http://127.0.0.1:-1') - check_proxy('http://127.0.0.1:7080b') + check_proxy('http://127.0.0.1:8080b') check_proxy('http://[]') - check_proxy('http://[]:7080') - check_proxy('http://[:]:7080') - check_proxy('http://[::7080') + check_proxy('http://[]:8080') + check_proxy('http://[:]:8080') + check_proxy('http://[::8080') @pytest.mark.skip('not yet') @@ -486,11 +486,11 @@ def test_proxy_loop(skip_alert): assert 'success' in client.conf( { "listeners": { - "*:7080": {"pass": "routes"}, - "*:7081": {"pass": "applications/mirror"}, - "*:7082": {"pass": "routes"}, + "*:8080": {"pass": "routes"}, + "*:8081": {"pass": "applications/mirror"}, + "*:8082": {"pass": "routes"}, }, - "routes": [{"action": {"proxy": "http://127.0.0.1:7082"}}], + "routes": [{"action": {"proxy": "http://127.0.0.1:8082"}}], "applications": { "mirror": { "type": client.get_application_type(), diff --git a/test/test_proxy_chunked.py b/test/test_proxy_chunked.py index a066e1e8..f9e9fe10 100644 --- a/test/test_proxy_chunked.py +++ b/test/test_proxy_chunked.py @@ -22,7 +22,7 @@ def setup_method_fixture(): assert 'success' in client.conf( { "listeners": { - "*:7080": {"pass": "routes"}, + "*:8080": {"pass": "routes"}, }, "routes": [ {"action": {"proxy": f'http://127.0.0.1:{SERVER_PORT}'}} diff --git a/test/test_python_application.py b/test/test_python_application.py index 18473d59..058a87df 100644 --- a/test/test_python_application.py +++ b/test/test_python_application.py @@ -160,7 +160,7 @@ def test_python_application_server_port(): client.load('server_port') assert ( - client.get()['headers']['Server-Port'] == '7080' + client.get()['headers']['Server-Port'] == '8080' ), 'Server-Port header' diff --git a/test/test_python_basic.py b/test/test_python_basic.py index 37859c8c..81c768aa 100644 --- a/test/test_python_basic.py +++ b/test/test_python_basic.py @@ -14,7 +14,7 @@ conf_app = { } conf_basic = { - "listeners": {"*:7080": {"pass": "applications/app"}}, + "listeners": {"*:8080": {"pass": "applications/app"}}, "applications": conf_app, } @@ -64,14 +64,14 @@ def test_python_get_listeners(): assert 'success' in client.conf(conf_basic) assert client.conf_get()['listeners'] == { - "*:7080": {"pass": "applications/app"} + "*:8080": {"pass": "applications/app"} }, 'listeners' assert client.conf_get('listeners') == { - "*:7080": {"pass": "applications/app"} + "*:8080": {"pass": "applications/app"} }, 'listeners prefix' - assert client.conf_get('listeners/*:7080') == { + assert client.conf_get('listeners/*:8080') == { "pass": "applications/app" }, 'listeners prefix 2' @@ -79,23 +79,23 @@ def test_python_get_listeners(): def test_python_change_listener(): assert 'success' in client.conf(conf_basic) assert 'success' in client.conf( - {"*:7081": {"pass": "applications/app"}}, 'listeners' + {"*:8081": {"pass": "applications/app"}}, 'listeners' ) assert client.conf_get('listeners') == { - "*:7081": {"pass": "applications/app"} + "*:8081": {"pass": "applications/app"} }, 'change listener' def test_python_add_listener(): assert 'success' in client.conf(conf_basic) assert 'success' in client.conf( - {"pass": "applications/app"}, 'listeners/*:7082' + {"pass": "applications/app"}, 'listeners/*:8082' ) assert client.conf_get('listeners') == { - "*:7080": {"pass": "applications/app"}, - "*:7082": {"pass": "applications/app"}, + "*:8080": {"pass": "applications/app"}, + "*:8082": {"pass": "applications/app"}, }, 'add listener' @@ -117,7 +117,7 @@ def test_python_delete(): assert 'success' in client.conf(conf_basic) assert 'error' in client.conf_delete('applications/app') - assert 'success' in client.conf_delete('listeners/*:7080') + assert 'success' in client.conf_delete('listeners/*:8080') assert 'success' in client.conf_delete('applications/app') assert 'error' in client.conf_delete('applications/app') @@ -130,5 +130,5 @@ def test_python_delete_blocks(): assert 'success' in client.conf(conf_app, 'applications') assert 'success' in client.conf( - {"*:7081": {"pass": "applications/app"}}, 'listeners' + {"*:8081": {"pass": "applications/app"}}, 'listeners' ), 'applications restore' diff --git a/test/test_python_isolation.py b/test/test_python_isolation.py index 260a87a2..5b97e292 100644 --- a/test/test_python_isolation.py +++ b/test/test_python_isolation.py @@ -151,8 +151,8 @@ def test_python_isolation_cgroup_two(require): assert 'success' in client.conf( { "listeners": { - "*:7080": {"pass": "applications/one"}, - "*:7081": {"pass": "applications/two"}, + "*:8080": {"pass": "applications/one"}, + "*:8081": {"pass": "applications/two"}, }, "applications": { "one": { @@ -193,7 +193,7 @@ def test_python_isolation_cgroup_invalid(require): script_path = f'{option.test_dir}/python/empty' assert 'error' in client.conf( { - "listeners": {"*:7080": {"pass": "applications/empty"}}, + "listeners": {"*:8080": {"pass": "applications/empty"}}, "applications": { "empty": { "type": "python", diff --git a/test/test_python_targets.py b/test/test_python_targets.py index 46e77c19..10f10b70 100644 --- a/test/test_python_targets.py +++ b/test/test_python_targets.py @@ -11,7 +11,7 @@ def test_python_targets(): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "routes"}}, + "listeners": {"*:8080": {"pass": "routes"}}, "routes": [ { "match": {"uri": "/1"}, @@ -56,7 +56,7 @@ def test_python_targets_prefix(): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "routes"}}, + "listeners": {"*:8080": {"pass": "routes"}}, "routes": [ { "match": {"uri": ["/app*"]}, diff --git a/test/test_reconfigure.py b/test/test_reconfigure.py index 53258b41..a5fe1b1a 100644 --- a/test/test_reconfigure.py +++ b/test/test_reconfigure.py @@ -10,7 +10,7 @@ client = ApplicationProto() def setup_method_fixture(): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "routes"}}, + "listeners": {"*:8080": {"pass": "routes"}}, "routes": [{"action": {"return": 200}}], "applications": {}, } diff --git a/test/test_reconfigure_tls.py b/test/test_reconfigure_tls.py index b473b147..50638391 100644 --- a/test/test_reconfigure_tls.py +++ b/test/test_reconfigure_tls.py @@ -20,7 +20,7 @@ def setup_method_fixture(): assert 'success' in client.conf( { "listeners": { - "*:7080": { + "*:8080": { "pass": "routes", "tls": {"certificate": "default"}, } @@ -40,7 +40,7 @@ def create_socket(): ssl_sock = ctx.wrap_socket( s, server_hostname='localhost', do_handshake_on_connect=False ) - ssl_sock.connect(('127.0.0.1', 7080)) + ssl_sock.connect(('127.0.0.1', 8080)) return ssl_sock @@ -51,7 +51,7 @@ def clear_conf(): @pytest.mark.skip('not yet') def test_reconfigure_tls_switch(): - assert 'success' in client.conf_delete('listeners/*:7080/tls') + assert 'success' in client.conf_delete('listeners/*:8080/tls') (_, sock) = client.get( headers={'Host': 'localhost', 'Connection': 'keep-alive'}, @@ -61,7 +61,7 @@ def test_reconfigure_tls_switch(): assert 'success' in client.conf( {"pass": "routes", "tls": {"certificate": "default"}}, - 'listeners/*:7080', + 'listeners/*:8080', ) assert client.get(sock=sock)['status'] == 200, 'reconfigure' diff --git a/test/test_response_headers.py b/test/test_response_headers.py index 50f47d9a..ec07c8c4 100644 --- a/test/test_response_headers.py +++ b/test/test_response_headers.py @@ -17,7 +17,7 @@ def setup_method_fixture(temp_dir): assert 'success' in client.conf( { "listeners": { - "*:7080": {"pass": "routes"}, + "*:8080": {"pass": "routes"}, }, "routes": [ { @@ -59,7 +59,7 @@ def test_response_last_action(): assert 'success' in client.conf( { "listeners": { - "*:7080": {"pass": "routes/first"}, + "*:8080": {"pass": "routes/first"}, }, "routes": { "first": [ @@ -91,7 +91,7 @@ def test_response_pass(require): assert 'success' in client_python.conf( { "listeners": { - "*:7080": {"pass": "routes"}, + "*:8080": {"pass": "routes"}, }, "routes": [ { @@ -121,7 +121,7 @@ def test_response_pass(require): def test_response_fallback(): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "routes"}}, + "listeners": {"*:8080": {"pass": "routes"}}, "routes": [ { "action": { diff --git a/test/test_return.py b/test/test_return.py index 35525ed5..3ffcaa4e 100644 --- a/test/test_return.py +++ b/test/test_return.py @@ -10,7 +10,7 @@ client = ApplicationProto() def setup_method_fixture(): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "routes"}}, + "listeners": {"*:8080": {"pass": "routes"}}, "routes": [{"action": {"return": 200}}], "applications": {}, } diff --git a/test/test_rewrite.py b/test/test_rewrite.py index 8d81ec49..0a4ffe42 100644 --- a/test/test_rewrite.py +++ b/test/test_rewrite.py @@ -10,7 +10,7 @@ client = ApplicationProto() def setup_method_fixture(): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "routes"}}, + "listeners": {"*:8080": {"pass": "routes"}}, "routes": [ { "match": {"uri": "/"}, @@ -112,7 +112,7 @@ def test_rewrite_location(): def check_location(rewrite, expect): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "routes"}}, + "listeners": {"*:8080": {"pass": "routes"}}, "routes": [ { "action": { @@ -141,7 +141,7 @@ def test_rewrite_share(temp_dir): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "routes"}}, + "listeners": {"*:8080": {"pass": "routes"}}, "routes": [ { "action": { @@ -162,7 +162,7 @@ def test_rewrite_share(temp_dir): index_path = f'{temp_dir}${{request_uri}}/index.html' assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "routes"}}, + "listeners": {"*:8080": {"pass": "routes"}}, "routes": [ { "match": {"uri": "/foo"}, @@ -182,7 +182,7 @@ def test_rewrite_share(temp_dir): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "routes"}}, + "listeners": {"*:8080": {"pass": "routes"}}, "routes": [ { "match": {"uri": "/foo"}, diff --git a/test/test_routing.py b/test/test_routing.py index a18edb04..ce5952eb 100644 --- a/test/test_routing.py +++ b/test/test_routing.py @@ -12,7 +12,7 @@ client = ApplicationPython() def setup_method_fixture(): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "routes"}}, + "listeners": {"*:8080": {"pass": "routes"}}, "routes": [ { "match": {"method": "GET"}, @@ -322,7 +322,7 @@ def test_routes_pass_encode(): def check_pass(path, name): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": f'applications/{path}'}}, + "listeners": {"*:8080": {"pass": f'applications/{path}'}}, "applications": { name: { "type": client.get_application_type(), @@ -345,7 +345,7 @@ def test_routes_pass_encode(): def check_pass_error(path, name): assert 'error' in client.conf( { - "listeners": {"*:7080": {"pass": f'applications/{path}'}}, + "listeners": {"*:8080": {"pass": f'applications/{path}'}}, "applications": { name: { "type": client.get_application_type(), @@ -365,7 +365,7 @@ def test_routes_pass_encode(): def test_routes_absent(): assert 'success' in client.conf( { - "listeners": {"*:7081": {"pass": "applications/empty"}}, + "listeners": {"*:8081": {"pass": "applications/empty"}}, "applications": { "empty": { "type": client.get_application_type(), @@ -378,19 +378,19 @@ def test_routes_absent(): } ) - assert client.get(port=7081)['status'] == 200, 'routes absent' + assert client.get(port=8081)['status'] == 200, 'routes absent' def test_routes_pass_invalid(): assert 'error' in client.conf( - {"pass": "routes/blah"}, 'listeners/*:7080' + {"pass": "routes/blah"}, 'listeners/*:8080' ), 'routes invalid' def test_route_empty(): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "routes/main"}}, + "listeners": {"*:8080": {"pass": "routes/main"}}, "routes": {"main": []}, "applications": {}, } @@ -437,14 +437,14 @@ def test_routes_route_pass(): "upstreams": { "one": { "servers": { - "127.0.0.1:7081": {}, - "127.0.0.1:7082": {}, + "127.0.0.1:8081": {}, + "127.0.0.1:8082": {}, }, }, "two": { "servers": { - "127.0.0.1:7081": {}, - "127.0.0.1:7082": {}, + "127.0.0.1:8081": {}, + "127.0.0.1:8082": {}, }, }, }, @@ -480,14 +480,14 @@ def test_routes_route_pass_invalid(): "upstreams": { "one": { "servers": { - "127.0.0.1:7081": {}, - "127.0.0.1:7082": {}, + "127.0.0.1:8081": {}, + "127.0.0.1:8082": {}, }, }, "two": { "servers": { - "127.0.0.1:7081": {}, - "127.0.0.1:7082": {}, + "127.0.0.1:8081": {}, + "127.0.0.1:8082": {}, }, }, }, @@ -512,10 +512,10 @@ def test_routes_action_unique(temp_dir): assert 'success' in client.conf( { "listeners": { - "*:7080": {"pass": "routes"}, - "*:7081": {"pass": "applications/app"}, + "*:8080": {"pass": "routes"}, + "*:8081": {"pass": "applications/app"}, }, - "routes": [{"action": {"proxy": "http://127.0.0.1:7081"}}], + "routes": [{"action": {"proxy": "http://127.0.0.1:8081"}}], "applications": { "app": { "type": client.get_application_type(), @@ -528,12 +528,12 @@ def test_routes_action_unique(temp_dir): ) assert 'error' in client.conf( - {"proxy": "http://127.0.0.1:7081", "share": temp_dir}, + {"proxy": "http://127.0.0.1:8081", "share": temp_dir}, 'routes/0/action', ), 'proxy share' assert 'error' in client.conf( { - "proxy": "http://127.0.0.1:7081", + "proxy": "http://127.0.0.1:8081", "pass": "applications/app", }, 'routes/0/action', @@ -560,7 +560,7 @@ def test_routes_rules_two(): def test_routes_two(): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "routes/first"}}, + "listeners": {"*:8080": {"pass": "routes/first"}}, "routes": { "first": [ { @@ -606,14 +606,14 @@ def test_routes_match_host_ipv4(): route_match({"host": "127.0.0.1"}) host('127.0.0.1', 200) - host('127.0.0.1:7080', 200) + host('127.0.0.1:8080', 200) def test_routes_match_host_ipv6(): route_match({"host": "[::1]"}) host('[::1]', 200) - host('[::1]:7080', 200) + host('[::1]:8080', 200) def test_routes_match_host_positive_many(): @@ -649,7 +649,7 @@ def test_routes_match_host_case_insensitive(): def test_routes_match_host_port(): route_match({"host": "example.com"}) - host('example.com:7080', 200) + host('example.com:8080', 200) def test_routes_match_host_empty(): @@ -718,7 +718,7 @@ def test_routes_reconfigure(): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "routes/main"}}, + "listeners": {"*:8080": {"pass": "routes/main"}}, "routes": {"main": [{"action": {"return": 200}}]}, "applications": {}, } @@ -801,7 +801,7 @@ def test_routes_edit(): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "routes/main"}}, + "listeners": {"*:8080": {"pass": "routes/main"}}, "routes": {"main": [{"action": {"return": 200}}]}, "applications": {}, } @@ -817,7 +817,7 @@ def test_routes_edit(): assert client.get()['status'] == 200, 'routes edit GET 7' assert 'success' in client.conf_delete( - 'listeners/*:7080' + 'listeners/*:8080' ), 'route edit configure 8' assert 'success' in client.conf_delete( 'routes/main' @@ -1646,14 +1646,14 @@ def test_routes_source_port(): def test_routes_source_addr(): assert 'success' in client.conf( { - "*:7080": {"pass": "routes"}, - "[::1]:7081": {"pass": "routes"}, + "*:8080": {"pass": "routes"}, + "[::1]:8081": {"pass": "routes"}, }, 'listeners', ), 'source listeners configure' def get_ipv6(): - return client.get(sock_type='ipv6', port=7081) + return client.get(sock_type='ipv6', port=8081) route_match({"source": "127.0.0.1"}) assert client.get()['status'] == 200, 'exact' @@ -1707,64 +1707,64 @@ def test_routes_source_addr(): def test_routes_source_ipv6(): assert 'success' in client.conf( { - "[::1]:7080": {"pass": "routes"}, - "127.0.0.1:7081": {"pass": "routes"}, + "[::1]:8080": {"pass": "routes"}, + "127.0.0.1:8081": {"pass": "routes"}, }, 'listeners', ), 'source listeners configure' route_match({"source": "::1"}) assert client.get(sock_type='ipv6')['status'] == 200, 'exact' - assert client.get(port=7081)['status'] == 404, 'exact ipv4' + assert client.get(port=8081)['status'] == 404, 'exact ipv4' route_match({"source": ["::1"]}) assert client.get(sock_type='ipv6')['status'] == 200, 'exact 2' - assert client.get(port=7081)['status'] == 404, 'exact 2 ipv4' + assert client.get(port=8081)['status'] == 404, 'exact 2 ipv4' route_match({"source": "!::1"}) assert client.get(sock_type='ipv6')['status'] == 404, 'exact neg' - assert client.get(port=7081)['status'] == 200, 'exact neg ipv4' + assert client.get(port=8081)['status'] == 200, 'exact neg ipv4' route_match({"source": "::2"}) assert client.get(sock_type='ipv6')['status'] == 404, 'exact 3' - assert client.get(port=7081)['status'] == 404, 'exact 3 ipv4' + assert client.get(port=8081)['status'] == 404, 'exact 3 ipv4' route_match({"source": "::1-::1"}) assert client.get(sock_type='ipv6')['status'] == 200, 'range' - assert client.get(port=7081)['status'] == 404, 'range ipv4' + assert client.get(port=8081)['status'] == 404, 'range ipv4' route_match({"source": "::2-::2"}) assert client.get(sock_type='ipv6')['status'] == 404, 'range 2' - assert client.get(port=7081)['status'] == 404, 'range 2 ipv4' + assert client.get(port=8081)['status'] == 404, 'range 2 ipv4' route_match({"source": "::2-::3"}) assert client.get(sock_type='ipv6')['status'] == 404, 'range 3' - assert client.get(port=7081)['status'] == 404, 'range 3 ipv4' + assert client.get(port=8081)['status'] == 404, 'range 3 ipv4' route_match({"source": "::1-::2"}) assert client.get(sock_type='ipv6')['status'] == 200, 'range 4' - assert client.get(port=7081)['status'] == 404, 'range 4 ipv4' + assert client.get(port=8081)['status'] == 404, 'range 4 ipv4' route_match({"source": "::0-::2"}) assert client.get(sock_type='ipv6')['status'] == 200, 'range 5' - assert client.get(port=7081)['status'] == 404, 'range 5 ipv4' + assert client.get(port=8081)['status'] == 404, 'range 5 ipv4' route_match({"source": "::0-::1"}) assert client.get(sock_type='ipv6')['status'] == 200, 'range 6' - assert client.get(port=7081)['status'] == 404, 'range 6 ipv4' + assert client.get(port=8081)['status'] == 404, 'range 6 ipv4' def test_routes_source_cidr(): assert 'success' in client.conf( { - "*:7080": {"pass": "routes"}, - "[::1]:7081": {"pass": "routes"}, + "*:8080": {"pass": "routes"}, + "[::1]:8081": {"pass": "routes"}, }, 'listeners', ), 'source listeners configure' def get_ipv6(): - return client.get(sock_type='ipv6', port=7081) + return client.get(sock_type='ipv6', port=8081) route_match({"source": "127.0.0.1/32"}) assert client.get()['status'] == 200, '32' @@ -1790,35 +1790,35 @@ def test_routes_source_cidr(): def test_routes_source_cidr_ipv6(): assert 'success' in client.conf( { - "[::1]:7080": {"pass": "routes"}, - "127.0.0.1:7081": {"pass": "routes"}, + "[::1]:8080": {"pass": "routes"}, + "127.0.0.1:8081": {"pass": "routes"}, }, 'listeners', ), 'source listeners configure' route_match({"source": "::1/128"}) assert client.get(sock_type='ipv6')['status'] == 200, '128' - assert client.get(port=7081)['status'] == 404, '128 ipv4' + assert client.get(port=8081)['status'] == 404, '128 ipv4' route_match({"source": "::0/128"}) assert client.get(sock_type='ipv6')['status'] == 404, '128 2' - assert client.get(port=7081)['status'] == 404, '128 ipv4' + assert client.get(port=8081)['status'] == 404, '128 ipv4' route_match({"source": "::0/127"}) assert client.get(sock_type='ipv6')['status'] == 200, '127' - assert client.get(port=7081)['status'] == 404, '127 ipv4' + assert client.get(port=8081)['status'] == 404, '127 ipv4' route_match({"source": "::0/32"}) assert client.get(sock_type='ipv6')['status'] == 200, '32' - assert client.get(port=7081)['status'] == 404, '32 ipv4' + assert client.get(port=8081)['status'] == 404, '32 ipv4' route_match({"source": "::0/1"}) assert client.get(sock_type='ipv6')['status'] == 200, '1' - assert client.get(port=7081)['status'] == 404, '1 ipv4' + assert client.get(port=8081)['status'] == 404, '1 ipv4' route_match({"source": "::/0"}) assert client.get(sock_type='ipv6')['status'] == 200, '0' - assert client.get(port=7081)['status'] == 404, '0 ipv4' + assert client.get(port=8081)['status'] == 404, '0 ipv4' def test_routes_source_unix(temp_dir): @@ -1826,7 +1826,7 @@ def test_routes_source_unix(temp_dir): assert 'success' in client.conf( { - "127.0.0.1:7081": {"pass": "routes"}, + "127.0.0.1:8081": {"pass": "routes"}, f'unix:{addr}': {"pass": "routes"}, }, 'listeners', @@ -1843,7 +1843,7 @@ def test_routes_source_unix(temp_dir): ), 'unix ipv6 neg' route_match({"source": "unix"}) - assert client.get(port=7081)['status'] == 404, 'unix ipv4' + assert client.get(port=8081)['status'] == 404, 'unix ipv4' assert client.get(sock_type='unix', addr=addr)['status'] == 200, 'unix' @@ -1916,7 +1916,7 @@ def test_routes_match_source_invalid(): route_match_invalid({"source": "2001::/129"}) route_match_invalid({"source": "::FFFFF"}) route_match_invalid({"source": "[::1]:"}) - route_match_invalid({"source": "[:::]:7080"}) + route_match_invalid({"source": "[:::]:8080"}) route_match_invalid({"source": "*:"}) route_match_invalid({"source": "*:1-a"}) route_match_invalid({"source": "*:65536"}) @@ -1929,74 +1929,74 @@ def test_routes_match_source_none(): def test_routes_match_destination(): assert 'success' in client.conf( - {"*:7080": {"pass": "routes"}, "*:7081": {"pass": "routes"}}, + {"*:8080": {"pass": "routes"}, "*:8081": {"pass": "routes"}}, 'listeners', ), 'listeners configure' - route_match({"destination": "*:7080"}) + route_match({"destination": "*:8080"}) assert client.get()['status'] == 200, 'dest' - assert client.get(port=7081)['status'] == 404, 'dest 2' + assert client.get(port=8081)['status'] == 404, 'dest 2' - route_match({"destination": ["127.0.0.1:7080"]}) + route_match({"destination": ["127.0.0.1:8080"]}) assert client.get()['status'] == 200, 'dest 3' - assert client.get(port=7081)['status'] == 404, 'dest 4' + assert client.get(port=8081)['status'] == 404, 'dest 4' - route_match({"destination": "!*:7080"}) + route_match({"destination": "!*:8080"}) assert client.get()['status'] == 404, 'dest neg' - assert client.get(port=7081)['status'] == 200, 'dest neg 2' + assert client.get(port=8081)['status'] == 200, 'dest neg 2' - route_match({"destination": ['!*:7080', '!*:7081']}) + route_match({"destination": ['!*:8080', '!*:8081']}) assert client.get()['status'] == 404, 'dest neg 3' - assert client.get(port=7081)['status'] == 404, 'dest neg 4' + assert client.get(port=8081)['status'] == 404, 'dest neg 4' - route_match({"destination": ['!*:7081', '!*:7082']}) + route_match({"destination": ['!*:8081', '!*:8082']}) assert client.get()['status'] == 200, 'dest neg 5' - route_match({"destination": ['*:7080', '!*:7080']}) + route_match({"destination": ['*:8080', '!*:8080']}) assert client.get()['status'] == 404, 'dest neg 6' - route_match({"destination": ['127.0.0.1:7080', '*:7081', '!*:7080']}) + route_match({"destination": ['127.0.0.1:8080', '*:8081', '!*:8080']}) assert client.get()['status'] == 404, 'dest neg 7' - assert client.get(port=7081)['status'] == 200, 'dest neg 8' + assert client.get(port=8081)['status'] == 200, 'dest neg 8' - route_match({"destination": ['!*:7081', '!*:7082', '*:7083']}) + route_match({"destination": ['!*:8081', '!*:8082', '*:8083']}) assert client.get()['status'] == 404, 'dest neg 9' - route_match({"destination": ['*:7081', '!127.0.0.1:7080', '*:7080']}) + route_match({"destination": ['*:8081', '!127.0.0.1:8080', '*:8080']}) assert client.get()['status'] == 404, 'dest neg 10' - assert client.get(port=7081)['status'] == 200, 'dest neg 11' + assert client.get(port=8081)['status'] == 200, 'dest neg 11' assert 'success' in client.conf_delete( 'routes/0/match/destination/0' ), 'remove destination rule' assert client.get()['status'] == 404, 'dest neg 12' - assert client.get(port=7081)['status'] == 404, 'dest neg 13' + assert client.get(port=8081)['status'] == 404, 'dest neg 13' assert 'success' in client.conf_delete( 'routes/0/match/destination/0' ), 'remove destination rule 2' assert client.get()['status'] == 200, 'dest neg 14' - assert client.get(port=7081)['status'] == 404, 'dest neg 15' + assert client.get(port=8081)['status'] == 404, 'dest neg 15' assert 'success' in client.conf_post( "\"!127.0.0.1\"", 'routes/0/match/destination' ), 'add destination rule' assert client.get()['status'] == 404, 'dest neg 16' - assert client.get(port=7081)['status'] == 404, 'dest neg 17' + assert client.get(port=8081)['status'] == 404, 'dest neg 17' def test_routes_match_destination_proxy(): assert 'success' in client.conf( { "listeners": { - "*:7080": {"pass": "routes/first"}, - "*:7081": {"pass": "routes/second"}, + "*:8080": {"pass": "routes/first"}, + "*:8081": {"pass": "routes/second"}, }, "routes": { - "first": [{"action": {"proxy": "http://127.0.0.1:7081"}}], + "first": [{"action": {"proxy": "http://127.0.0.1:8081"}}], "second": [ { - "match": {"destination": ["127.0.0.1:7081"]}, + "match": {"destination": ["127.0.0.1:8081"]}, "action": {"return": 200}, } ], diff --git a/test/test_routing_tls.py b/test/test_routing_tls.py index 4a97c8e4..f8cef546 100644 --- a/test/test_routing_tls.py +++ b/test/test_routing_tls.py @@ -11,8 +11,8 @@ def test_routes_match_scheme_tls(): assert 'success' in client.conf( { "listeners": { - "*:7080": {"pass": "routes"}, - "*:7081": { + "*:8080": {"pass": "routes"}, + "*:8081": { "pass": "routes", "tls": {"certificate": 'default'}, }, @@ -26,4 +26,4 @@ def test_routes_match_scheme_tls(): ), 'scheme configure' assert client.get()['status'] == 200, 'http' - assert client.get_ssl(port=7081)['status'] == 201, 'https' + assert client.get_ssl(port=8081)['status'] == 201, 'https' diff --git a/test/test_ruby_application.py b/test/test_ruby_application.py index 6f533b70..f187cc45 100644 --- a/test/test_ruby_application.py +++ b/test/test_ruby_application.py @@ -91,7 +91,7 @@ def test_ruby_application_server_port(): client.load('server_port') assert ( - client.get()['headers']['Server-Port'] == '7080' + client.get()['headers']['Server-Port'] == '8080' ), 'Server-Port header' diff --git a/test/test_settings.py b/test/test_settings.py index 33180046..0cdc6c0d 100644 --- a/test/test_settings.py +++ b/test/test_settings.py @@ -460,7 +460,7 @@ def test_settings_log_route(findall, search_in_file, wait_for_record): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "routes"}}, + "listeners": {"*:8080": {"pass": "routes"}}, "routes": [ { "match": { @@ -487,7 +487,7 @@ def test_settings_log_route(findall, search_in_file, wait_for_record): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "routes/main"}}, + "listeners": {"*:8080": {"pass": "routes/main"}}, "routes": { "main": [ { @@ -516,7 +516,7 @@ def test_settings_log_route(findall, search_in_file, wait_for_record): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "routes/first"}}, + "listeners": {"*:8080": {"pass": "routes/first"}}, "routes": { "first": [ { @@ -541,7 +541,7 @@ def test_settings_log_route(findall, search_in_file, wait_for_record): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "routes/fall"}}, + "listeners": {"*:8080": {"pass": "routes/fall"}}, "routes": { "fall": [ { diff --git a/test/test_static.py b/test/test_static.py index d46247d9..98f27c7f 100644 --- a/test/test_static.py +++ b/test/test_static.py @@ -26,7 +26,7 @@ def setup_method_fixture(temp_dir): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "routes"}}, + "listeners": {"*:8080": {"pass": "routes"}}, "routes": [{"action": {"share": f'{assets_dir}$uri'}}], "settings": { "http": { diff --git a/test/test_static_chroot.py b/test/test_static_chroot.py index 6b4dd89a..fb14d7ab 100644 --- a/test/test_static_chroot.py +++ b/test/test_static_chroot.py @@ -20,7 +20,7 @@ def setup_method_fixture(temp_dir): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "routes"}}, + "listeners": {"*:8080": {"pass": "routes"}}, "routes": [{"action": {"share": f'{temp_dir}/assets$uri'}}], } ) diff --git a/test/test_static_fallback.py b/test/test_static_fallback.py index ffc888ab..25e466a3 100644 --- a/test/test_static_fallback.py +++ b/test/test_static_fallback.py @@ -19,8 +19,8 @@ def setup_method_fixture(temp_dir): assert 'success' in client.conf( { "listeners": { - "*:7080": {"pass": "routes"}, - "*:7081": {"pass": "routes"}, + "*:8080": {"pass": "routes"}, + "*:8081": {"pass": "routes"}, }, "routes": [{"action": {"share": f'{assets_dir}$uri'}}], "applications": {}, @@ -108,13 +108,13 @@ def test_static_fallback_proxy(): assert 'success' in client.conf( [ { - "match": {"destination": "*:7081"}, + "match": {"destination": "*:8081"}, "action": {"return": 200}, }, { "action": { "share": "/blah", - "fallback": {"proxy": "http://127.0.0.1:7081"}, + "fallback": {"proxy": "http://127.0.0.1:8081"}, } }, ], @@ -136,11 +136,11 @@ def test_static_fallback_proxy_loop(skip_alert): ) action_update( - {"share": "/blah", "fallback": {"proxy": "http://127.0.0.1:7080"}} + {"share": "/blah", "fallback": {"proxy": "http://127.0.0.1:8080"}} ) client.get(no_recv=True) - assert 'success' in client.conf_delete('listeners/*:7081') + assert 'success' in client.conf_delete('listeners/*:8081') client.get(read_timeout=1) @@ -152,6 +152,6 @@ def test_static_fallback_invalid(): check_error({"share": "/blah", "fallback": ""}) check_error({"return": 200, "fallback": {"share": "/blah"}}) check_error( - {"proxy": "http://127.0.0.1:7081", "fallback": {"share": "/blah"}} + {"proxy": "http://127.0.0.1:8081", "fallback": {"share": "/blah"}} ) check_error({"fallback": {"share": "/blah"}}) diff --git a/test/test_static_mount.py b/test/test_static_mount.py index ccd18919..d8d3b698 100644 --- a/test/test_static_mount.py +++ b/test/test_static_mount.py @@ -38,7 +38,7 @@ def setup_method_fixture(temp_dir): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "routes"}}, + "listeners": {"*:8080": {"pass": "routes"}}, "routes": [{"action": {"share": f'{temp_dir}/assets/dir$uri'}}], } ) diff --git a/test/test_static_share.py b/test/test_static_share.py index ac5afb50..fa16d267 100644 --- a/test/test_static_share.py +++ b/test/test_static_share.py @@ -17,7 +17,7 @@ def setup_method_fixture(temp_dir): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "routes"}}, + "listeners": {"*:8080": {"pass": "routes"}}, "routes": [{"action": {"share": f'{temp_dir}/assets$uri'}}], "applications": {}, } diff --git a/test/test_static_symlink.py b/test/test_static_symlink.py index 1f7d7907..3b04d70c 100644 --- a/test/test_static_symlink.py +++ b/test/test_static_symlink.py @@ -17,7 +17,7 @@ def setup_method_fixture(temp_dir): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "routes"}}, + "listeners": {"*:8080": {"pass": "routes"}}, "routes": [{"action": {"share": f'{temp_dir}/assets$uri'}}], } ) diff --git a/test/test_static_types.py b/test/test_static_types.py index 8cd28ca4..a468319a 100644 --- a/test/test_static_types.py +++ b/test/test_static_types.py @@ -17,8 +17,8 @@ def setup_method_fixture(temp_dir): assert 'success' in client.conf( { "listeners": { - "*:7080": {"pass": "routes"}, - "*:7081": {"pass": "routes"}, + "*:8080": {"pass": "routes"}, + "*:8081": {"pass": "routes"}, }, "routes": [{"action": {"share": f'{temp_dir}/assets$uri'}}], "applications": {}, @@ -124,14 +124,14 @@ def test_static_types_fallback(temp_dir): assert 'success' in client.conf( [ { - "match": {"destination": "*:7081"}, + "match": {"destination": "*:8081"}, "action": {"return": 200}, }, { "action": { "share": f'{temp_dir}/assets$uri', "types": ["!application/x-httpd-php"], - "fallback": {"proxy": "http://127.0.0.1:7081"}, + "fallback": {"proxy": "http://127.0.0.1:8081"}, } }, ], @@ -155,7 +155,7 @@ def test_static_types_index(temp_dir): def test_static_types_custom_mime(temp_dir): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "routes"}}, + "listeners": {"*:8080": {"pass": "routes"}}, "routes": [{"action": {"share": f'{temp_dir}/assets$uri'}}], "applications": {}, "settings": { diff --git a/test/test_static_variables.py b/test/test_static_variables.py index bc39e90e..5afd0127 100644 --- a/test/test_static_variables.py +++ b/test/test_static_variables.py @@ -17,7 +17,7 @@ def setup_method_fixture(temp_dir): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "routes"}}, + "listeners": {"*:8080": {"pass": "routes"}}, "routes": [{"action": {"share": f'{temp_dir}/assets$uri'}}], } ) diff --git a/test/test_status.py b/test/test_status.py index 11b140cf..a52f7486 100644 --- a/test/test_status.py +++ b/test/test_status.py @@ -39,9 +39,9 @@ def test_status_requests(skip_alert): assert 'success' in client.conf( { "listeners": { - "*:7080": {"pass": "routes"}, - "*:7081": {"pass": "applications/empty"}, - "*:7082": {"pass": "applications/blah"}, + "*:8080": {"pass": "routes"}, + "*:8081": {"pass": "applications/empty"}, + "*:8082": {"pass": "applications/blah"}, }, "routes": [{"action": {"return": 200}}], "applications": { @@ -60,7 +60,7 @@ def test_status_requests(skip_alert): assert client.get()['status'] == 200 assert Status.get('/requests/total') == 1, '2xx' - assert client.get(port=7081)['status'] == 200 + assert client.get(port=8081)['status'] == 200 assert Status.get('/requests/total') == 2, '2xx app' assert ( @@ -69,7 +69,7 @@ def test_status_requests(skip_alert): ) assert Status.get('/requests/total') == 3, '4xx' - assert client.get(port=7082)['status'] == 503 + assert client.get(port=8082)['status'] == 503 assert Status.get('/requests/total') == 4, '5xx' client.http( @@ -85,7 +85,7 @@ Connection: close ) assert Status.get('/requests/total') == 6, 'pipeline' - sock = client.get(port=7081, no_recv=True) + sock = client.get(port=8081, no_recv=True) time.sleep(1) @@ -98,8 +98,8 @@ def test_status_connections(): assert 'success' in client.conf( { "listeners": { - "*:7080": {"pass": "routes"}, - "*:7081": {"pass": "applications/delayed"}, + "*:8080": {"pass": "routes"}, + "*:8081": {"pass": "applications/delayed"}, }, "routes": [{"action": {"return": 200}}], "applications": { @@ -136,7 +136,7 @@ def test_status_connections(): 'X-Delay': '2', 'Connection': 'close', }, - port=7081, + port=8081, start=True, read_timeout=1, ) @@ -194,8 +194,8 @@ def test_status_applications(): assert 'success' in client.conf( { "listeners": { - "*:7080": {"pass": "applications/restart"}, - "*:7081": {"pass": "applications/delayed"}, + "*:8080": {"pass": "applications/restart"}, + "*:8081": {"pass": "applications/delayed"}, }, "routes": [], "applications": { @@ -220,13 +220,13 @@ def test_status_proxy(): assert 'success' in client.conf( { "listeners": { - "*:7080": {"pass": "routes"}, - "*:7081": {"pass": "applications/empty"}, + "*:8080": {"pass": "routes"}, + "*:8081": {"pass": "applications/empty"}, }, "routes": [ { "match": {"uri": "/"}, - "action": {"proxy": "http://127.0.0.1:7081"}, + "action": {"proxy": "http://127.0.0.1:8081"}, } ], "applications": { diff --git a/test/test_status_tls.py b/test/test_status_tls.py index 784b4960..f69f021e 100644 --- a/test/test_status_tls.py +++ b/test/test_status_tls.py @@ -12,8 +12,8 @@ def test_status_tls_requests(): assert 'success' in client.conf( { "listeners": { - "*:7080": {"pass": "routes"}, - "*:7081": { + "*:8080": {"pass": "routes"}, + "*:8081": { "pass": "routes", "tls": {"certificate": "default"}, }, @@ -26,6 +26,6 @@ def test_status_tls_requests(): Status.init() assert client.get()['status'] == 200 - assert client.get_ssl(port=7081)['status'] == 200 + assert client.get_ssl(port=8081)['status'] == 200 assert Status.get('/requests/total') == 2 diff --git a/test/test_tls.py b/test/test_tls.py index 54fdb665..a56d5428 100644 --- a/test/test_tls.py +++ b/test/test_tls.py @@ -12,7 +12,7 @@ prerequisites = {'modules': {'python': 'any', 'openssl': 'any'}} client = ApplicationTLS() -def add_tls(application='empty', cert='default', port=7080): +def add_tls(application='empty', cert='default', port=8080): assert 'success' in client.conf( { "pass": f"applications/{application}", @@ -85,7 +85,7 @@ basicConstraints = critical,CA:TRUE""" f.write('') -def remove_tls(application='empty', port=7080): +def remove_tls(application='empty', port=8080): assert 'success' in client.conf( {"pass": f"applications/{application}"}, f'listeners/*:{port}' ) @@ -178,12 +178,12 @@ def test_tls_certificate_update(): add_tls() - cert_old = ssl.get_server_certificate(('127.0.0.1', 7080)) + cert_old = ssl.get_server_certificate(('127.0.0.1', 8080)) client.certificate() assert cert_old != ssl.get_server_certificate( - ('127.0.0.1', 7080) + ('127.0.0.1', 8080) ), 'update certificate' @@ -207,12 +207,12 @@ def test_tls_certificate_change(): add_tls() - cert_old = ssl.get_server_certificate(('127.0.0.1', 7080)) + cert_old = ssl.get_server_certificate(('127.0.0.1', 8080)) add_tls(cert='new') assert cert_old != ssl.get_server_certificate( - ('127.0.0.1', 7080) + ('127.0.0.1', 8080) ), 'change certificate' @@ -542,7 +542,7 @@ def test_tls_no_close_notify(): assert 'success' in client.conf( { "listeners": { - "*:7080": { + "*:8080": { "pass": "routes", "tls": {"certificate": "default"}, } @@ -576,7 +576,7 @@ def test_tls_keepalive_certificate_remove(): ) assert 'success' in client.conf( - {"pass": "applications/empty"}, 'listeners/*:7080' + {"pass": "applications/empty"}, 'listeners/*:8080' ) assert 'success' in client.conf_delete('/certificates/default') @@ -697,8 +697,8 @@ def test_tls_multi_listener(): client.certificate() add_tls() - add_tls(port=7081) + add_tls(port=8081) assert client.get_ssl()['status'] == 200, 'listener #1' - assert client.get_ssl(port=7081)['status'] == 200, 'listener #2' + assert client.get_ssl(port=8081)['status'] == 200, 'listener #2' diff --git a/test/test_tls_conf_command.py b/test/test_tls_conf_command.py index 49df7bf3..4d772c83 100644 --- a/test/test_tls_conf_command.py +++ b/test/test_tls_conf_command.py @@ -15,7 +15,7 @@ def setup_method_fixture(): assert 'success' in client.conf( { "listeners": { - "*:7080": { + "*:8080": { "pass": "routes", "tls": {"certificate": "default"}, } @@ -55,7 +55,7 @@ def test_tls_conf_command(): "certificate": "default", "conf_commands": {"protocol": f'-{protocol}'}, }, - 'listeners/*:7080/tls', + 'listeners/*:8080/tls', ), 'protocol disabled' sock.close() @@ -84,7 +84,7 @@ def test_tls_conf_command(): "cipherstring": f"{cipher[1]}:!{cipher[0]}", }, }, - 'listeners/*:7080/tls', + 'listeners/*:8080/tls', ), 'cipher disabled' if len(ciphers) > 1: @@ -106,7 +106,7 @@ def test_tls_conf_command_invalid(skip_alert): def check_conf_commands(conf_commands): assert 'error' in client.conf( {"certificate": "default", "conf_commands": conf_commands}, - 'listeners/*:7080/tls', + 'listeners/*:8080/tls', ), 'ivalid conf_commands' check_conf_commands([]) diff --git a/test/test_tls_session.py b/test/test_tls_session.py index 8b2b04fd..8da0306a 100644 --- a/test/test_tls_session.py +++ b/test/test_tls_session.py @@ -26,7 +26,7 @@ def setup_method_fixture(): assert 'success' in client.conf( { "listeners": { - "*:7080": { + "*:8080": { "pass": "routes", "tls": {"certificate": "default", "session": {}}, } @@ -45,11 +45,11 @@ def add_session(cache_size=None, timeout=None): if timeout is not None: session['timeout'] = timeout - return client.conf(session, 'listeners/*:7080/tls/session') + return client.conf(session, 'listeners/*:8080/tls/session') def connect(ctx=None, session=None): - sock = socket.create_connection(('127.0.0.1', 7080)) + sock = socket.create_connection(('127.0.0.1', 8080)) if ctx is None: ctx = Context(TLSv1_2_METHOD) diff --git a/test/test_tls_sni.py b/test/test_tls_sni.py index 253d9813..aa7ed3c5 100644 --- a/test/test_tls_sni.py +++ b/test/test_tls_sni.py @@ -14,7 +14,7 @@ client = ApplicationTLS() def setup_method_fixture(): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "routes"}}, + "listeners": {"*:8080": {"pass": "routes"}}, "routes": [{"action": {"return": 200}}], "applications": {}, } @@ -24,7 +24,7 @@ def setup_method_fixture(): def add_tls(cert='default'): assert 'success' in client.conf( {"pass": "routes", "tls": {"certificate": cert}}, - 'listeners/*:7080', + 'listeners/*:8080', ) @@ -141,7 +141,7 @@ def load_certs(bundles): def remove_tls(): - assert 'success' in client.conf({"pass": "routes"}, 'listeners/*:7080') + assert 'success' in client.conf({"pass": "routes"}, 'listeners/*:8080') def test_tls_sni(): @@ -289,7 +289,7 @@ def test_tls_sni_invalid(): def check_certificate(cert): assert 'error' in client.conf( {"pass": "routes", "tls": {"certificate": cert}}, - 'listeners/*:7080', + 'listeners/*:8080', ) check_certificate('') diff --git a/test/test_tls_tickets.py b/test/test_tls_tickets.py index 0d8e4f36..5e899a9b 100644 --- a/test/test_tls_tickets.py +++ b/test/test_tls_tickets.py @@ -36,9 +36,9 @@ def setup_method_fixture(): assert 'success' in client.conf( { "listeners": { - "*:7080": listener_conf, - "*:7081": listener_conf, - "*:7082": listener_conf, + "*:8080": listener_conf, + "*:8081": listener_conf, + "*:8082": listener_conf, }, "routes": [{"action": {"return": 200}}], "applications": {}, @@ -46,7 +46,7 @@ def setup_method_fixture(): ), 'load application configuration' -def connect(ctx=None, session=None, port=7080): +def connect(ctx=None, session=None, port=8080): sock = socket.create_connection(('127.0.0.1', port)) if ctx is None: @@ -72,7 +72,7 @@ def has_ticket(sess): return _lib.SSL_SESSION_has_ticket(sess._session) -def set_tickets(tickets=True, port=7080): +def set_tickets(tickets=True, port=8080): assert 'success' in client.conf( {"cache_size": 0, "tickets": tickets}, f'listeners/*:{port}/tls/session', @@ -98,7 +98,7 @@ def test_tls_ticket(): assert not has_ticket(sess), 'tickets False' assert 'success' in client.conf_delete( - 'listeners/*:7080/tls/session/tickets' + 'listeners/*:8080/tls/session/tickets' ), 'tickets default configure' sess, _, _ = connect() @@ -118,13 +118,13 @@ def test_tls_ticket_string(): assert has_ticket(sess2), 'tickets string reconnect' assert reused, 'tickets string reused' - sess2, _, reused = connect(ctx, sess, port=7081) + sess2, _, reused = connect(ctx, sess, port=8081) assert has_ticket(sess2), 'connect True' assert not reused, 'connect True not reused' - set_tickets(TICKET2, port=7081) + set_tickets(TICKET2, port=8081) - sess2, _, reused = connect(ctx, sess, port=7081) + sess2, _, reused = connect(ctx, sess, port=8081) assert has_ticket(sess2), 'wrong ticket' assert not reused, 'wrong ticket not reused' @@ -137,7 +137,7 @@ def test_tls_ticket_string(): assert has_ticket(sess2), 'tickets string 80 reconnect' assert reused, 'tickets string 80 reused' - sess2, _, reused = connect(ctx, sess, port=7081) + sess2, _, reused = connect(ctx, sess, port=8081) assert has_ticket(sess2), 'wrong ticket 80' assert not reused, 'wrong ticket 80 not reused' @@ -153,34 +153,34 @@ def test_tls_ticket_array(): assert not has_ticket(sess), 'tickets array empty' set_tickets([TICKET, TICKET2]) - set_tickets(TICKET, port=7081) - set_tickets(TICKET2, port=7082) + set_tickets(TICKET, port=8081) + set_tickets(TICKET2, port=8082) sess, ctx, _ = connect() - _, _, reused = connect(ctx, sess, port=7081) + _, _, reused = connect(ctx, sess, port=8081) assert not reused, 'not last ticket' - _, _, reused = connect(ctx, sess, port=7082) + _, _, reused = connect(ctx, sess, port=8082) assert reused, 'last ticket' - sess, ctx, _ = connect(port=7081) + sess, ctx, _ = connect(port=8081) _, _, reused = connect(ctx, sess) assert reused, 'first ticket' - sess, ctx, _ = connect(port=7082) + sess, ctx, _ = connect(port=8082) _, _, reused = connect(ctx, sess) assert reused, 'second ticket' assert 'success' in client.conf_delete( - 'listeners/*:7080/tls/session/tickets/0' + 'listeners/*:8080/tls/session/tickets/0' ), 'removed first ticket' assert 'success' in client.conf_post( - f'"{TICKET}"', 'listeners/*:7080/tls/session/tickets' + f'"{TICKET}"', 'listeners/*:8080/tls/session/tickets' ), 'add new ticket to the end of array' sess, ctx, _ = connect() - _, _, reused = connect(ctx, sess, port=7082) + _, _, reused = connect(ctx, sess, port=8082) assert not reused, 'not last ticket 2' - _, _, reused = connect(ctx, sess, port=7081) + _, _, reused = connect(ctx, sess, port=8081) assert reused, 'last ticket 2' @@ -188,7 +188,7 @@ def test_tls_ticket_invalid(): def check_tickets(tickets): assert 'error' in client.conf( {"tickets": tickets}, - 'listeners/*:7080/tls/session', + 'listeners/*:8080/tls/session', ) check_tickets({}) diff --git a/test/test_unix_abstract.py b/test/test_unix_abstract.py index 7ed2389c..6e304293 100644 --- a/test/test_unix_abstract.py +++ b/test/test_unix_abstract.py @@ -18,7 +18,7 @@ def test_unix_abstract_source(): assert 'success' in client.conf( { "listeners": { - "127.0.0.1:7080": {"pass": "routes"}, + "127.0.0.1:8080": {"pass": "routes"}, f"unix:@{addr[1:]}": {"pass": "routes"}, }, "routes": [ @@ -44,8 +44,8 @@ def test_unix_abstract_source(): def test_unix_abstract_client_ip(): def get_xff(xff, sock_type='ipv4'): address = { - 'ipv4': ('127.0.0.1', 7080), - 'ipv6': ('::1', 7081), + 'ipv4': ('127.0.0.1', 8080), + 'ipv6': ('::1', 8081), 'unix': ('\0sock', None), } (addr, port) = address[sock_type] @@ -61,14 +61,14 @@ def test_unix_abstract_client_ip(): assert 'success' in client.conf( { "listeners": { - "127.0.0.1:7080": { + "127.0.0.1:8080": { "client_ip": { "header": "X-Forwarded-For", "source": "unix", }, "pass": "applications/client_ip", }, - "[::1]:7081": { + "[::1]:8081": { "client_ip": { "header": "X-Forwarded-For", "source": "unix", diff --git a/test/test_upstreams_rr.py b/test/test_upstreams_rr.py index 046b5614..ecf24add 100644 --- a/test/test_upstreams_rr.py +++ b/test/test_upstreams_rr.py @@ -15,23 +15,23 @@ def setup_method_fixture(): assert 'success' in client.conf( { "listeners": { - "*:7080": {"pass": "upstreams/one"}, - "*:7090": {"pass": "upstreams/two"}, - "*:7081": {"pass": "routes/one"}, - "*:7082": {"pass": "routes/two"}, - "*:7083": {"pass": "routes/three"}, + "*:8080": {"pass": "upstreams/one"}, + "*:8090": {"pass": "upstreams/two"}, + "*:8081": {"pass": "routes/one"}, + "*:8082": {"pass": "routes/two"}, + "*:8083": {"pass": "routes/three"}, }, "upstreams": { "one": { "servers": { - "127.0.0.1:7081": {}, - "127.0.0.1:7082": {}, + "127.0.0.1:8081": {}, + "127.0.0.1:8082": {}, }, }, "two": { "servers": { - "127.0.0.1:7081": {}, - "127.0.0.1:7082": {}, + "127.0.0.1:8081": {}, + "127.0.0.1:8082": {}, }, }, }, @@ -47,7 +47,7 @@ def setup_method_fixture(): client.cpu_count = os.cpu_count() -def get_resps(req=100, port=7080): +def get_resps(req=100, port=8080): resps = [0] for _ in range(req): @@ -64,7 +64,7 @@ def get_resps(req=100, port=7080): return resps -def get_resps_sc(req=100, port=7080): +def get_resps_sc(req=100, port=8080): to_send = b"""GET / HTTP/1.1 Host: localhost @@ -96,14 +96,14 @@ def test_upstreams_rr_no_weight(): assert abs(resps[0] - resps[1]) <= client.cpu_count, 'no weight' assert 'success' in client.conf_delete( - 'upstreams/one/servers/127.0.0.1:7081' + 'upstreams/one/servers/127.0.0.1:8081' ), 'no weight server remove' resps = get_resps(req=50) assert resps[1] == 50, 'no weight 2' assert 'success' in client.conf( - {}, 'upstreams/one/servers/127.0.0.1:7081' + {}, 'upstreams/one/servers/127.0.0.1:8081' ), 'no weight server revert' resps = get_resps() @@ -111,7 +111,7 @@ def test_upstreams_rr_no_weight(): assert abs(resps[0] - resps[1]) <= client.cpu_count, 'no weight 3' assert 'success' in client.conf( - {}, 'upstreams/one/servers/127.0.0.1:7083' + {}, 'upstreams/one/servers/127.0.0.1:8083' ), 'no weight server new' resps = get_resps() @@ -126,7 +126,7 @@ def test_upstreams_rr_no_weight(): def test_upstreams_rr_weight(): assert 'success' in client.conf( - {"weight": 3}, 'upstreams/one/servers/127.0.0.1:7081' + {"weight": 3}, 'upstreams/one/servers/127.0.0.1:8081' ), 'configure weight' resps = get_resps_sc() @@ -134,14 +134,14 @@ def test_upstreams_rr_weight(): assert resps[1] == 25, 'weight 3 1' assert 'success' in client.conf_delete( - 'upstreams/one/servers/127.0.0.1:7081/weight' + 'upstreams/one/servers/127.0.0.1:8081/weight' ), 'configure weight remove' resps = get_resps_sc(req=10) assert resps[0] == 5, 'weight 0 0' assert resps[1] == 5, 'weight 0 1' assert 'success' in client.conf( - '1', 'upstreams/one/servers/127.0.0.1:7081/weight' + '1', 'upstreams/one/servers/127.0.0.1:8081/weight' ), 'configure weight 1' resps = get_resps_sc() @@ -150,8 +150,8 @@ def test_upstreams_rr_weight(): assert 'success' in client.conf( { - "127.0.0.1:7081": {"weight": 3}, - "127.0.0.1:7083": {"weight": 2}, + "127.0.0.1:8081": {"weight": 3}, + "127.0.0.1:8083": {"weight": 2}, }, 'upstreams/one/servers', ), 'configure weight 2' @@ -165,8 +165,8 @@ def test_upstreams_rr_weight_rational(): def set_weights(w1, w2): assert 'success' in client.conf( { - "127.0.0.1:7081": {"weight": w1}, - "127.0.0.1:7082": {"weight": w2}, + "127.0.0.1:8081": {"weight": w1}, + "127.0.0.1:8082": {"weight": w2}, }, 'upstreams/one/servers', ), 'configure weights' @@ -195,15 +195,15 @@ def test_upstreams_rr_weight_rational(): set_weights(0.25, 0.25) assert 'success' in client.conf_delete( - 'upstreams/one/servers/127.0.0.1:7081/weight' + 'upstreams/one/servers/127.0.0.1:8081/weight' ), 'delete weight' check_reqs(1, 0.25) assert 'success' in client.conf( { - "127.0.0.1:7081": {"weight": 0.1}, - "127.0.0.1:7082": {"weight": 1}, - "127.0.0.1:7083": {"weight": 0.9}, + "127.0.0.1:8081": {"weight": 0.1}, + "127.0.0.1:8082": {"weight": 1}, + "127.0.0.1:8083": {"weight": 0.9}, }, 'upstreams/one/servers', ), 'configure weights' @@ -221,7 +221,7 @@ def test_upstreams_rr_independent(): return sum_r - resps = get_resps_sc(req=30, port=7090) + resps = get_resps_sc(req=30, port=8090) assert resps[0] == 15, 'dep two before 0' assert resps[1] == 15, 'dep two before 1' @@ -230,10 +230,10 @@ def test_upstreams_rr_independent(): assert resps[1] == 15, 'dep one before 1' assert 'success' in client.conf( - '2', 'upstreams/two/servers/127.0.0.1:7081/weight' + '2', 'upstreams/two/servers/127.0.0.1:8081/weight' ), 'configure dep weight' - resps = get_resps_sc(req=30, port=7090) + resps = get_resps_sc(req=30, port=8090) assert resps[0] == 20, 'dep two 0' assert resps[1] == 10, 'dep two 1' @@ -242,13 +242,13 @@ def test_upstreams_rr_independent(): assert resps[1] == 15, 'dep one 1' assert 'success' in client.conf( - '1', 'upstreams/two/servers/127.0.0.1:7081/weight' + '1', 'upstreams/two/servers/127.0.0.1:8081/weight' ), 'configure dep weight 1' r_one, r_two = [0, 0], [0, 0] for _ in range(10): r_one = sum_resps(r_one, get_resps(req=10)) - r_two = sum_resps(r_two, get_resps(req=10, port=7090)) + r_two = sum_resps(r_two, get_resps(req=10, port=8090)) assert sum(r_one) == 100, 'dep one mix sum' assert abs(r_one[0] - r_one[1]) <= client.cpu_count, 'dep one mix' @@ -261,25 +261,25 @@ def test_upstreams_rr_delay(): assert 'success' in client.conf( { "listeners": { - "*:7080": {"pass": "upstreams/one"}, - "*:7081": {"pass": "routes"}, - "*:7082": {"pass": "routes"}, + "*:8080": {"pass": "upstreams/one"}, + "*:8081": {"pass": "routes"}, + "*:8082": {"pass": "routes"}, }, "upstreams": { "one": { "servers": { - "127.0.0.1:7081": {}, - "127.0.0.1:7082": {}, + "127.0.0.1:8081": {}, + "127.0.0.1:8082": {}, }, }, }, "routes": [ { - "match": {"destination": "*:7081"}, + "match": {"destination": "*:8081"}, "action": {"pass": "applications/delayed"}, }, { - "match": {"destination": "*:7082"}, + "match": {"destination": "*:8082"}, "action": {"return": 201}, }, ], @@ -351,14 +351,14 @@ Connection: close assert client.get()['body'] == '' assert 'success' in client.conf( - {"127.0.0.1:7083": {"weight": 2}}, + {"127.0.0.1:8083": {"weight": 2}}, 'upstreams/one/servers', ), 'active req new server' assert 'success' in client.conf_delete( - 'upstreams/one/servers/127.0.0.1:7083' + 'upstreams/one/servers/127.0.0.1:8083' ), 'active req server remove' assert 'success' in client.conf_delete( - 'listeners/*:7080' + 'listeners/*:8080' ), 'delete listener' assert 'success' in client.conf_delete( 'upstreams/one' @@ -377,7 +377,7 @@ Connection: close def test_upstreams_rr_bad_server(): assert 'success' in client.conf( - {"weight": 1}, 'upstreams/one/servers/127.0.0.1:7084' + {"weight": 1}, 'upstreams/one/servers/127.0.0.1:8084' ), 'configure bad server' resps = get_resps_sc(req=30) @@ -409,7 +409,7 @@ def test_upstreams_rr_unix(temp_dir): assert 'success' in client.conf( { - "*:7080": {"pass": "upstreams/one"}, + "*:8080": {"pass": "upstreams/one"}, f"unix:{addr_0}": {"pass": "routes/one"}, f"unix:{addr_1}": {"pass": "routes/two"}, }, @@ -430,15 +430,15 @@ def test_upstreams_rr_unix(temp_dir): def test_upstreams_rr_ipv6(): assert 'success' in client.conf( { - "*:7080": {"pass": "upstreams/one"}, - "[::1]:7081": {"pass": "routes/one"}, - "[::1]:7082": {"pass": "routes/two"}, + "*:8080": {"pass": "upstreams/one"}, + "[::1]:8081": {"pass": "routes/one"}, + "[::1]:8082": {"pass": "routes/two"}, }, 'listeners', ), 'configure listeners ipv6' assert 'success' in client.conf( - {"[::1]:7081": {}, "[::1]:7082": {}}, 'upstreams/one/servers' + {"[::1]:8081": {}, "[::1]:8082": {}}, 'upstreams/one/servers' ), 'configure servers ipv6' resps = get_resps_sc() @@ -454,13 +454,13 @@ def test_upstreams_rr_servers_empty(): assert client.get()['status'] == 502, 'servers empty' assert 'success' in client.conf( - {"127.0.0.1:7081": {"weight": 0}}, 'upstreams/one/servers' + {"127.0.0.1:8081": {"weight": 0}}, 'upstreams/one/servers' ), 'configure servers empty one' assert client.get()['status'] == 502, 'servers empty one' assert 'success' in client.conf( { - "127.0.0.1:7081": {"weight": 0}, - "127.0.0.1:7082": {"weight": 0}, + "127.0.0.1:8081": {"weight": 0}, + "127.0.0.1:8082": {"weight": 0}, }, 'upstreams/one/servers', ), 'configure servers empty two' @@ -474,12 +474,12 @@ def test_upstreams_rr_invalid(): {}, 'upstreams/one/servers/127.0.0.1' ), 'invalid address' assert 'error' in client.conf( - {}, 'upstreams/one/servers/127.0.0.1:7081/blah' + {}, 'upstreams/one/servers/127.0.0.1:8081/blah' ), 'invalid server option' def check_weight(w): assert 'error' in client.conf( - w, 'upstreams/one/servers/127.0.0.1:7081/weight' + w, 'upstreams/one/servers/127.0.0.1:8081/weight' ), 'invalid weight option' check_weight({}) diff --git a/test/test_variables.py b/test/test_variables.py index 813bd8c6..0b7b9ea8 100644 --- a/test/test_variables.py +++ b/test/test_variables.py @@ -16,7 +16,7 @@ client_python = ApplicationPython() def setup_method_fixture(): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "routes"}}, + "listeners": {"*:8080": {"pass": "routes"}}, "routes": [{"action": {"return": 200}}], }, ), 'configure routes' @@ -132,7 +132,7 @@ def test_variables_uri_no_cache(temp_dir): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "routes"}}, + "listeners": {"*:8080": {"pass": "routes"}}, "routes": [ { "action": { @@ -163,7 +163,7 @@ def test_variables_host(search_in_file, wait_for_record): check_host('localhost') check_host('localhost1.', 'localhost1') - check_host('localhost2:7080', 'localhost2') + check_host('localhost2:8080', 'localhost2') check_host('.localhost') check_host('www.localhost') @@ -175,7 +175,7 @@ def test_variables_remote_addr(search_in_file, wait_for_record): assert wait_for_record(r'^127\.0\.0\.1$', 'access.log') is not None assert 'success' in client.conf( - {"[::1]:7080": {"pass": "routes"}}, 'listeners' + {"[::1]:8080": {"pass": "routes"}}, 'listeners' ) reg = r'^::1$' @@ -447,7 +447,7 @@ def test_variables_response_header(temp_dir, wait_for_record): assert 'success' in client.conf( { - "listeners": {"*:7080": {"pass": "routes"}}, + "listeners": {"*:8080": {"pass": "routes"}}, "routes": [ { "action": { diff --git a/test/unit/applications/lang/go.py b/test/unit/applications/lang/go.py index 93e0738b..5aca5048 100644 --- a/test/unit/applications/lang/go.py +++ b/test/unit/applications/lang/go.py @@ -91,7 +91,7 @@ replace unit.nginx.org/go => {replace_path} ApplicationGo.prepare_env(script, name, static=static_build) conf = { - "listeners": {"*:7080": {"pass": f"applications/{script}"}}, + "listeners": {"*:8080": {"pass": f"applications/{script}"}}, "applications": { script: { "type": "external", diff --git a/test/unit/applications/lang/java.py b/test/unit/applications/lang/java.py index dc6d2bfc..4d207cea 100644 --- a/test/unit/applications/lang/java.py +++ b/test/unit/applications/lang/java.py @@ -97,7 +97,7 @@ class ApplicationJava(ApplicationProto): script_path = f'{option.test_dir}/java/{script}/' self._load_conf( { - "listeners": {"*:7080": {"pass": f"applications/{script}"}}, + "listeners": {"*:8080": {"pass": f"applications/{script}"}}, "applications": { script: { "unit_jars": f'{option.current_dir}/build', diff --git a/test/unit/applications/lang/node.py b/test/unit/applications/lang/node.py index 4f18c780..ff95fbd5 100644 --- a/test/unit/applications/lang/node.py +++ b/test/unit/applications/lang/node.py @@ -44,7 +44,7 @@ class ApplicationNode(ApplicationProto): self._load_conf( { "listeners": { - "*:7080": {"pass": f"applications/{quote(script, '')}"} + "*:8080": {"pass": f"applications/{quote(script, '')}"} }, "applications": { script: { diff --git a/test/unit/applications/lang/perl.py b/test/unit/applications/lang/perl.py index 037e98e8..e99c2aca 100644 --- a/test/unit/applications/lang/perl.py +++ b/test/unit/applications/lang/perl.py @@ -11,7 +11,7 @@ class ApplicationPerl(ApplicationProto): self._load_conf( { - "listeners": {"*:7080": {"pass": f"applications/{script}"}}, + "listeners": {"*:8080": {"pass": f"applications/{script}"}}, "applications": { script: { "type": self.get_application_type(), diff --git a/test/unit/applications/lang/php.py b/test/unit/applications/lang/php.py index b9b6dbf1..2ab172b0 100644 --- a/test/unit/applications/lang/php.py +++ b/test/unit/applications/lang/php.py @@ -42,7 +42,7 @@ class ApplicationPHP(ApplicationProto): self._load_conf( { - "listeners": {"*:7080": {"pass": f"applications/{script}"}}, + "listeners": {"*:8080": {"pass": f"applications/{script}"}}, "applications": {script: app}, }, **kwargs, diff --git a/test/unit/applications/lang/python.py b/test/unit/applications/lang/python.py index 4e1fd897..67304d12 100644 --- a/test/unit/applications/lang/python.py +++ b/test/unit/applications/lang/python.py @@ -59,7 +59,7 @@ class ApplicationPython(ApplicationProto): self._load_conf( { "listeners": { - "*:7080": {"pass": f"applications/{quote(name, '')}"} + "*:8080": {"pass": f"applications/{quote(name, '')}"} }, "applications": {name: app}, }, diff --git a/test/unit/applications/lang/ruby.py b/test/unit/applications/lang/ruby.py index f6c4f6c3..1268f8c7 100644 --- a/test/unit/applications/lang/ruby.py +++ b/test/unit/applications/lang/ruby.py @@ -37,7 +37,7 @@ class ApplicationRuby(ApplicationProto): self._load_conf( { - "listeners": {"*:7080": {"pass": f"applications/{script}"}}, + "listeners": {"*:8080": {"pass": f"applications/{script}"}}, "applications": {script: app}, }, **kwargs, diff --git a/test/unit/applications/tls.py b/test/unit/applications/tls.py index e9bcc514..50a27348 100644 --- a/test/unit/applications/tls.py +++ b/test/unit/applications/tls.py @@ -97,7 +97,7 @@ distinguished_name = req_distinguished_name script_path = f'{option.test_dir}/python/{script}' self._load_conf( { - "listeners": {"*:7080": {"pass": f"applications/{name}"}}, + "listeners": {"*:8080": {"pass": f"applications/{name}"}}, "applications": { name: { "type": "python", diff --git a/test/unit/check/chroot.py b/test/unit/check/chroot.py index b749fab6..466b6ba4 100644 --- a/test/unit/check/chroot.py +++ b/test/unit/check/chroot.py @@ -15,7 +15,7 @@ def check_chroot(): addr=f'{option.temp_dir}/control.unit.sock', body=json.dumps( { - "listeners": {"*:7080": {"pass": "routes"}}, + "listeners": {"*:8080": {"pass": "routes"}}, "routes": [ { "action": { diff --git a/test/unit/check/isolation.py b/test/unit/check/isolation.py index e4674f4d..e31179e8 100644 --- a/test/unit/check/isolation.py +++ b/test/unit/check/isolation.py @@ -21,7 +21,7 @@ def check_isolation(): ApplicationGo().prepare_env('empty', 'app') conf = { - "listeners": {"*:7080": {"pass": "applications/empty"}}, + "listeners": {"*:8080": {"pass": "applications/empty"}}, "applications": { "empty": { "type": "external", @@ -35,7 +35,7 @@ def check_isolation(): elif 'python' in available['modules']: conf = { - "listeners": {"*:7080": {"pass": "applications/empty"}}, + "listeners": {"*:8080": {"pass": "applications/empty"}}, "applications": { "empty": { "type": "python", @@ -50,7 +50,7 @@ def check_isolation(): elif 'php' in available['modules']: conf = { - "listeners": {"*:7080": {"pass": "applications/phpinfo"}}, + "listeners": {"*:8080": {"pass": "applications/phpinfo"}}, "applications": { "phpinfo": { "type": "php", @@ -67,7 +67,7 @@ def check_isolation(): ApplicationRuby().prepare_env('empty') conf = { - "listeners": {"*:7080": {"pass": "applications/empty"}}, + "listeners": {"*:8080": {"pass": "applications/empty"}}, "applications": { "empty": { "type": "ruby", @@ -83,7 +83,7 @@ def check_isolation(): ApplicationJava().prepare_env('empty') conf = { - "listeners": {"*:7080": {"pass": "applications/empty"}}, + "listeners": {"*:8080": {"pass": "applications/empty"}}, "applications": { "empty": { "unit_jars": f"{option.current_dir}/build", @@ -100,7 +100,7 @@ def check_isolation(): ApplicationNode().prepare_env('basic') conf = { - "listeners": {"*:7080": {"pass": "applications/basic"}}, + "listeners": {"*:8080": {"pass": "applications/basic"}}, "applications": { "basic": { "type": "external", @@ -114,7 +114,7 @@ def check_isolation(): elif 'perl' in available['modules']: conf = { - "listeners": {"*:7080": {"pass": "applications/body_empty"}}, + "listeners": {"*:8080": {"pass": "applications/body_empty"}}, "applications": { "body_empty": { "type": "perl", diff --git a/test/unit/http.py b/test/unit/http.py index 347382f5..5a6a1a1b 100644 --- a/test/unit/http.py +++ b/test/unit/http.py @@ -13,7 +13,7 @@ from unit.option import option class HTTP1: def http(self, start_str, **kwargs): sock_type = kwargs.get('sock_type', 'ipv4') - port = kwargs.get('port', 7080) + port = kwargs.get('port', 8080) url = kwargs.get('url', '/') http = 'HTTP/1.0' if 'http_10' in kwargs else 'HTTP/1.1' |