diff options
author | Andrei Zeliankou <zelenkov@nginx.com> | 2020-09-21 21:29:34 +0100 |
---|---|---|
committer | Andrei Zeliankou <zelenkov@nginx.com> | 2020-09-21 21:29:34 +0100 |
commit | 98c86c415caa5d40744f26f72c0d20a0bde058ee (patch) | |
tree | 5c1c61b99905bf3506dca03bb04bc88dae7ba88b | |
parent | 39008c1f05b30e9ac51cf7c46743c9d2dc34f505 (diff) | |
download | unit-98c86c415caa5d40744f26f72c0d20a0bde058ee.tar.gz unit-98c86c415caa5d40744f26f72c0d20a0bde058ee.tar.bz2 |
Tests: added variable test with nonexistent upstream.
Diffstat (limited to '')
-rw-r--r-- | test/test_variables.py | 23 |
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( |