summaryrefslogtreecommitdiffhomepage
path: root/test/test_variables.py
diff options
context:
space:
mode:
authorAndrei Zeliankou <zelenkov@nginx.com>2020-09-21 21:29:34 +0100
committerAndrei Zeliankou <zelenkov@nginx.com>2020-09-21 21:29:34 +0100
commit98c86c415caa5d40744f26f72c0d20a0bde058ee (patch)
tree5c1c61b99905bf3506dca03bb04bc88dae7ba88b /test/test_variables.py
parent39008c1f05b30e9ac51cf7c46743c9d2dc34f505 (diff)
downloadunit-98c86c415caa5d40744f26f72c0d20a0bde058ee.tar.gz
unit-98c86c415caa5d40744f26f72c0d20a0bde058ee.tar.bz2
Tests: added variable test with nonexistent upstream.
Diffstat (limited to 'test/test_variables.py')
-rw-r--r--test/test_variables.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/test_variables.py b/test/test_variables.py
index 0fa4296c..c458b636 100644
--- a/test/test_variables.py
+++ b/test/test_variables.py
@@ -87,6 +87,29 @@ class TestVariables(TestApplicationProto):
self.conf_routes("\"routes/blah$method}\"")
assert self.get()['status'] == 205
+ def test_variables_upstream(self):
+ assert 'success' in self.conf(
+ {
+ "listeners": {
+ "*:7080": {"pass": "upstreams$uri"},
+ "*:7081": {"pass": "routes/one"},
+ },
+ "upstreams": {
+ "1": {
+ "servers": {
+ "127.0.0.1:7081": {},
+ },
+ },
+ },
+ "routes": {
+ "one": [{"action": {"return": 200}}],
+ },
+ },
+ ), 'upstreams initial configuration'
+
+ assert self.get(url='/1')['status'] == 200
+ assert self.get(url='/2')['status'] == 404
+
def test_variables_invalid(self):
def check_variables(routes):
assert 'error' in self.conf(