summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIndrajit Raychaudhuri <irc@indrajit.com>2026-05-26 23:25:06 -0500
committerIndrajit Raychaudhuri <irc@indrajit.com>2026-06-19 03:08:06 -0500
commit4f550fc5184f7d583f5976e801e9cae4d06e0cb6 (patch)
tree070ca2ab3fe4f60a24d738c40ef16135326591fd
parented8f6f0b3527dfb68713fd88cf660e323868d8a0 (diff)
downloadvyos-1x-4f550fc5184f7d583f5976e801e9cae4d06e0cb6.tar.gz
vyos-1x-4f550fc5184f7d583f5976e801e9cae4d06e0cb6.zip
haproxy: T8931: Add simple smoketest for websocket backend
-rwxr-xr-xsmoketest/scripts/cli/test_load-balancing_haproxy.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/test_load-balancing_haproxy.py b/smoketest/scripts/cli/test_load-balancing_haproxy.py
index 7eeee4fde..118d42773 100755
--- a/smoketest/scripts/cli/test_load-balancing_haproxy.py
+++ b/smoketest/scripts/cli/test_load-balancing_haproxy.py
@@ -335,6 +335,34 @@ class TestLoadBalancingReverseProxy(VyOSUnitTestSHIM.TestCase):
with self.assertRaises(ConfigSessionError) as e:
self.cli_commit()
+ def test_reverse_proxy_backend_websocket(self):
+ t_tunnel = '3600'
+ opt_server_close = 'http-server-close'
+
+ # Setup base
+ self.configure_pki()
+ self.base_config()
+
+ # Set minimal backend websocket configuration
+ self.cli_set(base_path + ['backend', haproxy_backend_name, opt_server_close])
+ self.cli_set(base_path + ['backend', haproxy_backend_name, 'timeout', 'tunnel', t_tunnel])
+ self.cli_set(base_path + ['backend', haproxy_backend_name, 'ssl', 'no-verify'])
+
+ self.cli_commit()
+
+ # Ensure 'http-server-close' is not used in tcp mode, to test config validation
+ self.cli_set(base_path + ['backend', haproxy_backend_name, 'mode', 'tcp'])
+ with self.assertRaises(ConfigSessionError) as e:
+ self.cli_commit()
+
+ config = read_file(HAPROXY_CONF)
+ self.assertIn(f'option {opt_server_close}', config)
+ self.assertIn(f'timeout tunnel {t_tunnel}s', config)
+ self.assertIn('option forwardfor', config)
+ self.assertIn(' http-request set-header X-Forwarded-Port %[dst_port]', config)
+ self.assertIn('http-request add-header X-Forwarded-Proto https if { ssl_fc }', config)
+ self.assertIn(f'server {haproxy_backend_name} 192.0.2.11:9090 send-proxy ssl verify none', config)
+
def test_reverse_proxy_backend_http_check(self):
# Setup base
self.base_config()