Skip to content

Commit 5db348e

Browse files
committed
Fix the failing test
Remove redundant check for Nginx Plus case
1 parent 3c8aa38 commit 5db348e

File tree

2 files changed

+4
-18
lines changed

2 files changed

+4
-18
lines changed

tests/data/virtual-server-configmap-keys/configmap-validation-keys-invalid.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ metadata:
66
data:
77
proxy-buffering: "invalid"
88
real-ip-recursive: "invalid"
9-
server-tokens: "any \"string" # no validation applied to this in nginx plus case
9+
# server-tokens: "there is no invalid value in nginx plus case"
1010
lb-method: "invalid method"
1111
max-fails: "invalid"
1212
keepalive: "invalid"

tests/suite/test_virtual_server_configmap_keys.py

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -67,24 +67,15 @@ def assert_specific_keys_for_nginx_oss(config, expected_values):
6767
and expected_values['lb-method'] in config
6868

6969

70-
def assert_defaults_of_keys_with_validation(config):
70+
def assert_defaults_of_keys_with_validation(config, unexpected_values):
7171
assert "proxy_buffering on;" in config
7272
assert "real_ip_recursive" not in config
7373
assert "max_fails=1" in config
7474
assert "keepalive" not in config
7575
assert "listen 80;" in config
7676
assert "if ($http_x_forwarded_proto = 'http') {" not in config
77-
78-
79-
def assert_defaults_of_specific_keys_for_nginx_plus(config, expected_values):
80-
assert f"server_tokens \"{expected_values['server-tokens']}\"" in config
81-
assert "random two least_conn;" in config and expected_values['lb-method'] not in config
82-
83-
84-
def assert_defaults_of_specific_keys_for_nginx_oss(config, expected_values):
8577
assert "server_tokens \"on\"" in config
86-
assert "random two least_conn;" in config \
87-
and expected_values['lb-method'] not in config
78+
assert "random two least_conn;" in config and unexpected_values['lb-method'] not in config
8879

8980

9081
def assert_ssl_keys(config):
@@ -207,12 +198,7 @@ def test_keys(self, cli_arguments, kube_apis, ingress_controller_prerequisites,
207198
ingress_controller_prerequisites.namespace)
208199
step_4_events = get_events(kube_apis.v1, virtual_server_setup.namespace)
209200
assert_valid_event_count_increased(virtual_server_setup, step_4_events, step_3_events)
210-
assert_defaults_of_keys_with_validation(step_4_config)
211-
# to cover the OSS case, this will be changed in the future
212-
if cli_arguments['ic-type'] == "nginx-ingress":
213-
assert_defaults_of_specific_keys_for_nginx_oss(step_4_config, expected_values)
214-
else:
215-
assert_defaults_of_specific_keys_for_nginx_plus(step_4_config, expected_values)
201+
assert_defaults_of_keys_with_validation(step_4_config, expected_values)
216202

217203

218204
@pytest.mark.parametrize('crd_ingress_controller, virtual_server_setup',

0 commit comments

Comments
 (0)