diff --git a/internal/configs/version1/template_test.go b/internal/configs/version1/template_test.go index 79f3aed446..2285b60ece 100644 --- a/internal/configs/version1/template_test.go +++ b/internal/configs/version1/template_test.go @@ -679,12 +679,14 @@ func TestExecuteTemplate_ForMainForNGINXWithHTTP2On(t *testing.T) { } wantDirectives := []string{ + "listen 443 ssl default_server;", + "listen [::]:443 ssl default_server;", "http2 on;", } unwantDirectives := []string{ - "listen 443 ssl http2", - "listen [::]:443 ssl http2", + "listen 443 ssl default_server http2;", + "listen [::]:443 ssl default_server http2;", } mainConf := buf.String() @@ -715,12 +717,14 @@ func TestExecuteTemplate_ForMainForNGINXPlusWithHTTP2On(t *testing.T) { } wantDirectives := []string{ + "listen 443 ssl default_server;", + "listen [::]:443 ssl default_server;", "http2 on;", } unwantDirectives := []string{ - "listen 443 ssl http2", - "listen [::]:443 ssl http2", + "listen 443 ssl default_server http2;", + "listen [::]:443 ssl default_server http2;", } mainConf := buf.String() @@ -751,8 +755,8 @@ func TestExecuteTemplate_ForMainForNGINXWithHTTP2Off(t *testing.T) { } wantDirectives := []string{ - "listen 443 ssl", - "listen [::]:443 ssl", + "listen 443 ssl default_server;", + "listen [::]:443 ssl default_server;", } unwantDirectives := []string{ @@ -787,8 +791,8 @@ func TestExecuteTemplate_ForMainForNGINXPlusWithHTTP2Off(t *testing.T) { } wantDirectives := []string{ - "listen 443 ssl", - "listen [::]:443 ssl", + "listen 443 ssl default_server;", + "listen [::]:443 ssl default_server;", } unwantDirectives := []string{ @@ -823,12 +827,14 @@ func TestExecuteTemplate_ForIngressForNGINXPlusWithHTTP2On(t *testing.T) { ingConf := buf.String() wantDirectives := []string{ + "listen 443 ssl;", + "listen [::]:443 ssl;", "http2 on;", } unwantDirectives := []string{ - "listen 443 ssl http2", - "listen [::]:443 ssl http2", + "listen 443 ssl http2;", + "listen [::]:443 ssl http2;", } for _, want := range wantDirectives { @@ -858,12 +864,14 @@ func TestExecuteTemplate_ForIngressForNGINXWithHTTP2On(t *testing.T) { ingConf := buf.String() wantDirectives := []string{ + "listen 443 ssl;", + "listen [::]:443 ssl;", "http2 on;", } unwantDirectives := []string{ - "listen 443 ssl http2", - "listen [::]:443 ssl http2", + "listen 443 ssl http2;", + "listen [::]:443 ssl http2;", } for _, want := range wantDirectives { @@ -893,8 +901,8 @@ func TestExecuteTemplate_ForIngressForNGINXPlusWithHTTP2Off(t *testing.T) { ingConf := buf.String() wantDirectives := []string{ - "listen 443 ssl", - "listen [::]:443 ssl", + "listen 443 ssl;", + "listen [::]:443 ssl;", } unwantDirectives := []string{ @@ -928,8 +936,8 @@ func TestExecuteTemplate_ForIngressForNGINXWithHTTP2Off(t *testing.T) { ingConf := buf.String() wantDirectives := []string{ - "listen 443 ssl", - "listen [::]:443 ssl", + "listen 443 ssl;", + "listen [::]:443 ssl;", } unwantDirectives := []string{ diff --git a/internal/configs/version2/templates_test.go b/internal/configs/version2/templates_test.go index 112aac6dd8..9e9968c6c0 100644 --- a/internal/configs/version2/templates_test.go +++ b/internal/configs/version2/templates_test.go @@ -174,6 +174,8 @@ func TestExecuteVirtualServerTemplate_RendersPlusTemplateWithHTTP2On(t *testing. t.Error(err) } wantStrings := []string{ + "listen 443 ssl proxy_protocol;", + "listen [::]:443 ssl proxy_protocol;", "http2 on;", } for _, want := range wantStrings { @@ -183,8 +185,8 @@ func TestExecuteVirtualServerTemplate_RendersPlusTemplateWithHTTP2On(t *testing. } unwantStrings := []string{ - "listen 443 ssl http2", - "listen [::]:443 ssl http2", + "listen 443 ssl http2 proxy_protocol;", + "listen [::]:443 ssl http2 proxy_protocol;", } for _, want := range unwantStrings { @@ -204,8 +206,8 @@ func TestExecuteVirtualServerTemplate_RendersPlusTemplateWithHTTP2Off(t *testing t.Error(err) } wantStrings := []string{ - "listen 443 ssl", - "listen [::]:443 ssl", + "listen 443 ssl proxy_protocol;", + "listen [::]:443 ssl proxy_protocol;", } for _, want := range wantStrings { if !bytes.Contains(got, []byte(want)) { @@ -234,6 +236,8 @@ func TestExecuteVirtualServerTemplate_RendersOSSTemplateWithHTTP2On(t *testing.T t.Error(err) } wantStrings := []string{ + "listen 443 ssl proxy_protocol;", + "listen [::]:443 ssl proxy_protocol;", "http2 on;", } for _, want := range wantStrings { @@ -243,8 +247,8 @@ func TestExecuteVirtualServerTemplate_RendersOSSTemplateWithHTTP2On(t *testing.T } unwantStrings := []string{ - "listen 443 ssl http2", - "listen [::]:443 ssl http2", + "listen 443 ssl http2 proxy_protocol;", + "listen [::]:443 ssl http2 proxy_protocol;", } for _, want := range unwantStrings { @@ -264,8 +268,8 @@ func TestExecuteVirtualServerTemplate_RendersOSSTemplateWithHTTP2Off(t *testing. t.Error(err) } wantStrings := []string{ - "listen 443 ssl", - "listen [::]:443 ssl", + "listen 443 ssl proxy_protocol;", + "listen [::]:443 ssl proxy_protocol;", } for _, want := range wantStrings { if !bytes.Contains(got, []byte(want)) { diff --git a/tests/suite/test_virtual_server_configmap_keys.py b/tests/suite/test_virtual_server_configmap_keys.py index c49b2972d3..1fe9ceb276 100644 --- a/tests/suite/test_virtual_server_configmap_keys.py +++ b/tests/suite/test_virtual_server_configmap_keys.py @@ -114,13 +114,14 @@ def assert_defaults_of_keys_with_validation_in_main_config(config, unexpected_va def assert_ssl_keys(config): # based on f"{TEST_DATA}/virtual-server-configmap-keys/configmap-ssl-keys.yaml" assert "if ($schema = 'http') {" not in config - assert "listen 443 ssl http2 proxy_protocol;" in config + assert "listen 443 ssl proxy_protocol;" in config + assert "http2 on;" in config def assert_defaults_of_ssl_keys(config): assert "if ($schema = 'http') {" not in config assert "listen 443 ssl;" in config - assert "http2" not in config + assert "http2 on;" not in config @pytest.fixture(scope="function")