Skip to content

Commit

Permalink
Fix vs/vsr tests for connection headers
Browse files Browse the repository at this point in the history
* Was testing for the presence of "proxy_set_header Connection"
* Now tests for the presence of "set $default_connection_header"

$default_connection_header is a custom variable that is used for
upgrading to the Websocket protocol when using vs/vsr upstreams
  • Loading branch information
Dean-Coakley committed Aug 14, 2019
1 parent 06ec69e commit 61c1b49
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions tests/suite/test_v_s_route_upstream_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def test_nginx_config_upstreams_defaults(self, kube_apis, ingress_controller_pre
assert "max_fails=1 fail_timeout=10s max_conns=0;" in config

assert "keepalive" not in config
assert 'proxy_set_header Connection "";' not in config
assert 'set $default_connection_header "";' not in config

assert "proxy_next_upstream error timeout;" in config
assert "proxy_next_upstream_timeout 0s;" in config
Expand All @@ -82,7 +82,7 @@ def test_nginx_config_upstreams_defaults(self, kube_apis, ingress_controller_pre
"keepalive": 54, "max-conns": 1024},
["least_conn;", "max_fails=8 ",
"fail_timeout=13s ", "proxy_connect_timeout 55s;", "proxy_read_timeout 1s;",
"proxy_send_timeout 1h;", "keepalive 54;", 'proxy_set_header Connection "";', "max_conns=1024;"]),
"proxy_send_timeout 1h;", "keepalive 54;", 'set $default_connection_header "";', "max_conns=1024;"]),
({"lb-method": "ip_hash", "connect-timeout": "75", "read-timeout": "15", "send-timeout": "1h"},
["ip_hash;", "proxy_connect_timeout 75;", "proxy_read_timeout 15;", "proxy_send_timeout 1h;"]),
({"connect-timeout": "1m", "read-timeout": "1m", "send-timeout": "1s"},
Expand Down Expand Up @@ -140,7 +140,7 @@ def test_when_option_in_v_s_r_only(self, kube_apis,
(f"{TEST_DATA}/virtual-server-route-upstream-options/configmap-with-keys.yaml",
["max_fails=3 ", "fail_timeout=33s ", "max_conns=0;",
"proxy_connect_timeout 44s;", "proxy_read_timeout 22s;", "proxy_send_timeout 55s;",
"keepalive 1024;", 'proxy_set_header Connection "";'],
"keepalive 1024;", 'set $default_connection_header "";'],
["ip_hash;", "least_conn;", "random ", "hash", "least_time ",
"max_fails=1 ", "fail_timeout=10s ", "max_conns=1000;",
"proxy_connect_timeout 60s;", "proxy_read_timeout 60s;", "proxy_send_timeout 60s;"]),
Expand Down Expand Up @@ -194,7 +194,7 @@ def test_when_option_in_config_map_only(self, kube_apis,
"keepalive": 48},
["least_conn;", "max_fails=12 ",
"fail_timeout=1m ", "max_conns=0;", "proxy_connect_timeout 1m;", "proxy_read_timeout 77s;", "proxy_send_timeout 23s;",
"keepalive 48;", 'proxy_set_header Connection "";'],
"keepalive 48;", 'set $default_connection_header "";'],
["ip_hash;", "random ", "hash", "least_time ", "max_fails=1 ",
"fail_timeout=10s ", "proxy_connect_timeout 44s;", "proxy_read_timeout 22s;", "proxy_send_timeout 55s;",
"keepalive 1024;"])
Expand Down
8 changes: 4 additions & 4 deletions tests/suite/test_virtual_server_upstream_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def test_nginx_config_defaults(self, kube_apis, ingress_controller_prerequisites
assert "max_fails=1 fail_timeout=10s max_conns=0;" in config

assert "keepalive" not in config
assert 'proxy_set_header Connection "";' not in config
assert 'set $default_connection_header "";' not in config

assert "proxy_next_upstream error timeout;" in config
assert "proxy_next_upstream_timeout 0s;" in config
Expand All @@ -86,7 +86,7 @@ def test_nginx_config_defaults(self, kube_apis, ingress_controller_prerequisites
"keepalive": 54, "max-conns": 1048},
["least_conn;", "max_fails=8 ",
"fail_timeout=13s ", "proxy_connect_timeout 55s;", "proxy_read_timeout 1s;",
"proxy_send_timeout 1h;", "keepalive 54;", 'proxy_set_header Connection "";', "max_conns=1048;"]),
"proxy_send_timeout 1h;", "keepalive 54;", 'set $default_connection_header "";', "max_conns=1048;"]),
({"lb-method": "ip_hash", "connect-timeout": "75", "read-timeout": "15", "send-timeout": "1h"},
["ip_hash;", "proxy_connect_timeout 75;", "proxy_read_timeout 15;", "proxy_send_timeout 1h;"]),
({"connect-timeout": "1m", "read-timeout": "1m", "send-timeout": "1s"},
Expand Down Expand Up @@ -130,7 +130,7 @@ def test_when_option_in_v_s_only(self, kube_apis, ingress_controller_prerequisit
(f"{TEST_DATA}/virtual-server-upstream-options/configmap-with-keys.yaml",
["max_fails=3 ", "fail_timeout=33s ", "max_conns=0;",
"proxy_connect_timeout 44s;", "proxy_read_timeout 22s;", "proxy_send_timeout 55s;",
"keepalive 1024;", 'proxy_set_header Connection "";'],
"keepalive 1024;", 'set $default_connection_header "";'],
["ip_hash;", "least_conn;", "random ", "hash", "least_time ",
"max_fails=1 ", "fail_timeout=10s ", "max_conns=1000;",
"proxy_connect_timeout 60s;", "proxy_read_timeout 60s;", "proxy_send_timeout 60s;"]),
Expand Down Expand Up @@ -174,7 +174,7 @@ def test_when_option_in_config_map_only(self, kube_apis, ingress_controller_prer
"keepalive": 48},
["least_conn;", "max_fails=12 ",
"fail_timeout=1m ", "max_conns=0;", "proxy_connect_timeout 1m;", "proxy_read_timeout 77s;",
"proxy_send_timeout 23s;", "keepalive 48;", 'proxy_set_header Connection "";'],
"proxy_send_timeout 23s;", "keepalive 48;", 'set $default_connection_header "";'],
["ip_hash;", "random ", "hash", "least_time ", "max_fails=1 ",
"fail_timeout=10s ", "proxy_connect_timeout 44s;", "proxy_read_timeout 22s;",
"proxy_send_timeout 55s;", "keepalive 1024;"])
Expand Down

0 comments on commit 61c1b49

Please sign in to comment.