diff options
author | Christian Breunig <christian@breunig.cc> | 2024-04-21 12:54:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-21 12:54:13 +0200 |
commit | 2208c846d6bffeecac99afa7ebc3eda5c467aebc (patch) | |
tree | 984e88cdf2604bb418608fd8b2970c4f3739c710 /smoketest | |
parent | 8062edbefb311257c5f0dd5e6810334e4d120eb9 (diff) | |
parent | 98a0fdbef343c20c5054abea478a81e5b86c254f (diff) | |
download | vyos-1x-2208c846d6bffeecac99afa7ebc3eda5c467aebc.tar.gz vyos-1x-2208c846d6bffeecac99afa7ebc3eda5c467aebc.zip |
Merge pull request #3332 from vyos/mergify/bp/sagitta/pr-3325
T6246: basic haproxy http-check configuration (backport #3325)
Diffstat (limited to 'smoketest')
-rwxr-xr-x | smoketest/scripts/cli/test_load-balancing_reverse-proxy.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/test_load-balancing_reverse-proxy.py b/smoketest/scripts/cli/test_load-balancing_reverse-proxy.py index d21fc762b..737c07401 100755 --- a/smoketest/scripts/cli/test_load-balancing_reverse-proxy.py +++ b/smoketest/scripts/cli/test_load-balancing_reverse-proxy.py @@ -298,6 +298,40 @@ class TestLoadBalancingReverseProxy(VyOSUnitTestSHIM.TestCase): with self.assertRaises(ConfigSessionError) as e: self.cli_commit() + def test_05_lb_reverse_proxy_backend_http_check(self): + # Setup base + self.base_config() + + # Set http-check + self.cli_set(base_path + ['backend', 'bk-01', 'http-check', 'method', 'get']) + self.cli_commit() + + # Test http-check + config = read_file(HAPROXY_CONF) + self.assertIn('option httpchk', config) + self.assertIn('http-check send meth GET', config) + + # Set http-check with uri and status + self.cli_set(base_path + ['backend', 'bk-01', 'http-check', 'uri', '/health']) + self.cli_set(base_path + ['backend', 'bk-01', 'http-check', 'expect', 'status', '200']) + self.cli_commit() + + # Test http-check with uri and status + config = read_file(HAPROXY_CONF) + self.assertIn('option httpchk', config) + self.assertIn('http-check send meth GET uri /health', config) + self.assertIn('http-check expect status 200', config) + + # Set http-check with string + self.cli_delete(base_path + ['backend', 'bk-01', 'http-check', 'expect', 'status', '200']) + self.cli_set(base_path + ['backend', 'bk-01', 'http-check', 'expect', 'string', 'success']) + self.cli_commit() + + # Test http-check with string + config = read_file(HAPROXY_CONF) + self.assertIn('option httpchk', config) + self.assertIn('http-check send meth GET uri /health', config) + self.assertIn('http-check expect string success', config) if __name__ == '__main__': unittest.main(verbosity=2) |