From 98c86c415caa5d40744f26f72c0d20a0bde058ee Mon Sep 17 00:00:00 2001 From: Andrei Zeliankou Date: Mon, 21 Sep 2020 21:29:34 +0100 Subject: [PATCH] Tests: added variable test with nonexistent upstream. --- test/test_variables.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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(