summaryrefslogtreecommitdiffhomepage
path: root/test/test_static_fallback.py
diff options
context:
space:
mode:
authorDan Callahan <d.callahan@f5.com>2024-02-27 15:15:42 +0000
committerDan Callahan <d.callahan@f5.com>2024-02-27 15:15:42 +0000
commitd76761901c4084bcdbc5a449e9bbb47d56b7093c (patch)
treeb4b7b4e3d588b73a2adcc0094cab466d9194c679 /test/test_static_fallback.py
parentc43629880472bba8d389dfb0b7ae6d883b0ba499 (diff)
parent088117008c9e8f397a58cc8d8070ce047beff12f (diff)
downloadunit-1.32.0-1.tar.gz
unit-1.32.0-1.tar.bz2
Merge tag '1.32.0' into branches/packaging1.32.0-1
Unit 1.32.0 release.
Diffstat (limited to 'test/test_static_fallback.py')
-rw-r--r--test/test_static_fallback.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/test/test_static_fallback.py b/test/test_static_fallback.py
index ffc888ab..9b5fcb53 100644
--- a/test/test_static_fallback.py
+++ b/test/test_static_fallback.py
@@ -2,6 +2,7 @@ import os
from pathlib import Path
import pytest
+
from unit.applications.proto import ApplicationProto
client = ApplicationProto()
@@ -11,7 +12,7 @@ client = ApplicationProto()
def setup_method_fixture(temp_dir):
assets_dir = f'{temp_dir}/assets'
os.makedirs(f'{assets_dir}/dir')
- Path(f'{assets_dir}/index.html').write_text('0123456789')
+ Path(f'{assets_dir}/index.html').write_text('0123456789', encoding='utf-8')
os.makedirs(f'{assets_dir}/403')
os.chmod(f'{assets_dir}/403', 0o000)
@@ -19,8 +20,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 +109,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 +137,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 +153,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"}})