Skip to content

Commit 977f85e

Browse files
committed
fix snaps
1 parent 3f824b2 commit 977f85e

File tree

2 files changed

+2
-117
lines changed

2 files changed

+2
-117
lines changed

internal/configs/version1/__snapshots__/template_test.snap

Lines changed: 2 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,7 @@ server {
742742
proxy_read_timeout 10s;
743743
proxy_send_timeout 10s;
744744
client_max_body_size 2m;
745+
client_body_buffer_size 16k;
745746
proxy_set_header Host $host;
746747
proxy_set_header X-Real-IP $remote_addr;
747748
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@@ -900,7 +901,6 @@ server {
900901
proxy_read_timeout 10s;
901902
proxy_send_timeout 10s;
902903
client_max_body_size 2m;
903-
client_body_buffer_size 16k;
904904
905905
proxy_set_header Host $host;
906906
proxy_set_header X-Real-IP $remote_addr;
@@ -1278,6 +1278,7 @@ server {
12781278
proxy_read_timeout 10s;
12791279
proxy_send_timeout 10s;
12801280
client_max_body_size 2m;
1281+
client_body_buffer_size 16k;
12811282
12821283
proxy_set_header Host $host;
12831284
proxy_set_header X-Real-IP $remote_addr;
@@ -2333,7 +2334,6 @@ server {
23332334
proxy_read_timeout 10s;
23342335
proxy_send_timeout 10s;
23352336
client_max_body_size 2m;
2336-
client_body_buffer_size 16k;
23372337
proxy_set_header Host $host;
23382338
proxy_set_header X-Real-IP $remote_addr;
23392339
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@@ -2806,102 +2806,6 @@ server {
28062806
28072807
---
28082808
2809-
[TestExecuteTemplate_ForIngressWithoutClientBodyBufferSize - 1]
2810-
# configuration for default/cafe-ingress
2811-
upstream test {
2812-
zone test 256k;
2813-
server 127.0.0.1:8181 max_fails=0 fail_timeout=1s max_conns=0 slow_start=5s;keepalive 16;
2814-
}
2815-
2816-
2817-
2818-
2819-
server {
2820-
listen 443 ssl;listen [::]:443 ssl;
2821-
ssl_certificate secret.pem;
2822-
ssl_certificate_key secret.pem;
2823-
2824-
server_tokens "off";
2825-
2826-
server_name test.example.com;
2827-
2828-
status_zone test.example.com;
2829-
set $resource_type "ingress";
2830-
set $resource_name "cafe-ingress";
2831-
set $resource_namespace "default";
2832-
app_protect_enable on;
2833-
app_protect_policy_file /etc/nginx/waf/nac-policies/default-dataguard-alarm;
2834-
app_protect_security_log_enable on;
2835-
app_protect_security_log /etc/nginx/waf/nac-logconfs/test_logconf syslog:server=127.0.0.1:514;
2836-
app_protect_security_log /etc/nginx/waf/nac-logconfs/test_logconf2;
2837-
2838-
app_protect_dos_enable on;
2839-
app_protect_dos_policy_file /test/policy.json;
2840-
app_protect_dos_security_log_enable on;
2841-
app_protect_dos_security_log /test/logConf.json;
2842-
set $loggable '0';
2843-
# app-protect-dos module will set it to '1' if a request doesn't pass the rate limit
2844-
access_log /var/log/dos log_dos if=$loggable;
2845-
app_protect_dos_monitor uri=/path/to/monitor protocol=http1 timeout=30;
2846-
app_protect_dos_name "testdos";
2847-
app_protect_dos_access_file "/etc/nginx/dos/allowlist/default_test.example.com";
2848-
2849-
2850-
if ($scheme = http) {
2851-
return 301 https://$host:443$request_uri;
2852-
}
2853-
2854-
2855-
auth_jwt_key_file /etc/nginx/secrets/key.jwk;
2856-
auth_jwt "closed site" token=$cookie_auth_token;
2857-
error_page 401 @login_url-default-cafe-ingress;
2858-
2859-
location @hc-test {
2860-
proxy_set_header Test-Header "test-header-value";
2861-
proxy_connect_timeout 0s;
2862-
proxy_read_timeout 0s;
2863-
proxy_send_timeout 0s;
2864-
proxy_pass ://test;
2865-
health_check uri= interval=1s fails=1 passes=1;
2866-
}
2867-
2868-
location @login_url-default-cafe-ingress {
2869-
internal;
2870-
return 302 https://test.example.com/login;
2871-
}
2872-
2873-
location /tea {
2874-
set $service "";
2875-
status_zone "";
2876-
# location for minion default/tea-minion
2877-
set $resource_name "tea-minion";
2878-
set $resource_namespace "default";
2879-
proxy_http_version 1.1;
2880-
proxy_set_header Connection "";
2881-
auth_jwt_key_file /etc/nginx/secrets/location-key.jwk;
2882-
auth_jwt "closed site" token=$cookie_auth_token;
2883-
2884-
proxy_connect_timeout 10s;
2885-
proxy_read_timeout 10s;
2886-
proxy_send_timeout 10s;
2887-
client_max_body_size 2m;
2888-
2889-
proxy_set_header Host $host;
2890-
proxy_set_header X-Real-IP $remote_addr;
2891-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
2892-
proxy_set_header X-Forwarded-Host $host;
2893-
proxy_set_header X-Forwarded-Port $server_port;
2894-
proxy_set_header X-Forwarded-Proto $scheme;
2895-
proxy_buffering off;
2896-
proxy_pass http://test;
2897-
2898-
2899-
}
2900-
2901-
}
2902-
2903-
---
2904-
29052809
[TestExecuteTemplate_ForMainForNGINXPlusTLSPassthroughPortDisabled - 1]
29062810
worker_processes auto;
29072811
worker_rlimit_nofile 65536;

internal/configs/version1/template_test.go

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -325,25 +325,6 @@ func TestExecuteTemplate_ForIngressWithClientBodyBufferSize(t *testing.T) {
325325
snaps.MatchSnapshot(t, buf.String())
326326
}
327327

328-
func TestExecuteTemplate_ForIngressWithoutClientBodyBufferSize(t *testing.T) {
329-
t.Parallel()
330-
331-
tmpl := newNGINXPlusIngressTmpl(t)
332-
buf := &bytes.Buffer{}
333-
334-
err := tmpl.Execute(buf, ingressCfg)
335-
t.Log(buf.String())
336-
if err != nil {
337-
t.Fatal(err)
338-
}
339-
340-
want := "client_body_buffer_size 8k"
341-
if strings.Contains(buf.String(), want) {
342-
t.Errorf("want %q in generated config when ClientBodyBufferSize is not set", want)
343-
}
344-
snaps.MatchSnapshot(t, buf.String())
345-
}
346-
347328
func TestExecuteTemplate_ForMergeableIngressWithSecondMinionWithPathRegexAnnotation(t *testing.T) {
348329
t.Parallel()
349330

0 commit comments

Comments
 (0)