diff options
author | Christian Breunig <christian@breunig.cc> | 2024-07-04 10:35:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-04 10:35:01 +0200 |
commit | 8672c5f7ee2b760d52b6f2cd6427dda44d7188b5 (patch) | |
tree | 798e5a7789d09ab646145943ba4878e41337216d /smoketest | |
parent | c0bb68e763c28d4f7ac9fd87d86c38a62c6fc730 (diff) | |
parent | dd5908eac390294ea178953fc0e6821d803d62f6 (diff) | |
download | vyos-1x-8672c5f7ee2b760d52b6f2cd6427dda44d7188b5.tar.gz vyos-1x-8672c5f7ee2b760d52b6f2cd6427dda44d7188b5.zip |
Merge pull request #3753 from jvoss/haproxy_logging
T6539: add logging options to load-balancer reverse-proxy
Diffstat (limited to 'smoketest')
-rwxr-xr-x | smoketest/scripts/cli/test_load-balancing_reverse-proxy.py | 41 |
1 files changed, 41 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 aa796f59f..db43a78ec 100755 --- a/smoketest/scripts/cli/test_load-balancing_reverse-proxy.py +++ b/smoketest/scripts/cli/test_load-balancing_reverse-proxy.py @@ -458,6 +458,47 @@ class TestLoadBalancingReverseProxy(VyOSUnitTestSHIM.TestCase): config = read_file(HAPROXY_CONF) self.assertIn(f'option smtpchk', config) + def test_09_lb_reverse_proxy_logging(self): + # Setup base + self.base_config() + self.cli_commit() + + # Ensure default logging configuration is present + config = read_file(HAPROXY_CONF) + self.assertIn('log /dev/log local0', config) + self.assertIn('log /dev/log local1 notice', config) + + # Test global-parameters logging options + self.cli_set(base_path + ['global-parameters', 'logging', 'facility', 'local1', 'level', 'err']) + self.cli_set(base_path + ['global-parameters', 'logging', 'facility', 'local2', 'level', 'warning']) + self.cli_commit() + + # Test global logging parameters are generated in configuration file + config = read_file(HAPROXY_CONF) + self.assertIn('log /dev/log local1 err', config) + self.assertIn('log /dev/log local2 warning', config) + + # Test backend logging options + backend_path = base_path + ['backend', 'bk-01'] + self.cli_set(backend_path + ['logging', 'facility', 'local3', 'level', 'debug']) + self.cli_set(backend_path + ['logging', 'facility', 'local4', 'level', 'info']) + self.cli_commit() + + # Test backend logging parameters are generated in configuration file + config = read_file(HAPROXY_CONF) + self.assertIn('log /dev/log local3 debug', config) + self.assertIn('log /dev/log local4 info', config) + + # Test service logging options + service_path = base_path + ['service', 'https_front'] + self.cli_set(service_path + ['logging', 'facility', 'local5', 'level', 'notice']) + self.cli_set(service_path + ['logging', 'facility', 'local6', 'level', 'crit']) + self.cli_commit() + + # Test service logging parameters are generated in configuration file + config = read_file(HAPROXY_CONF) + self.assertIn('log /dev/log local5 notice', config) + self.assertIn('log /dev/log local6 crit', config) if __name__ == '__main__': unittest.main(verbosity=2) |