Skip to content

Commit 8b99268

Browse files
committed
fix snaps
1 parent b8f37b2 commit 8b99268

File tree

2 files changed

+72
-6
lines changed

2 files changed

+72
-6
lines changed

internal/configs/version1/__snapshots__/template_test.snap

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,6 @@ server {
890890
proxy_read_timeout 10s;
891891
proxy_send_timeout 10s;
892892
client_max_body_size 2m;
893-
client_body_buffer_size 16k;
894893
895894
proxy_set_header Host $host;
896895
proxy_set_header X-Real-IP $remote_addr;
@@ -1268,7 +1267,6 @@ server {
12681267
proxy_read_timeout 10s;
12691268
proxy_send_timeout 10s;
12701269
client_max_body_size 2m;
1271-
client_body_buffer_size 16k;
12721270
12731271
proxy_set_header Host $host;
12741272
proxy_set_header X-Real-IP $remote_addr;

internal/configs/version1/template_test.go

Lines changed: 72 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,7 @@ func TestExecuteTemplate_ForIngressWithClientBodyBufferSize(t *testing.T) {
309309
tmpl := newNGINXPlusIngressTmpl(t)
310310
buf := &bytes.Buffer{}
311311

312-
testCfg := ingressCfg
313-
testCfg.Servers[0].Locations[0].ClientBodyBufferSize = "16k"
314-
315-
err := tmpl.Execute(buf, testCfg)
312+
err := tmpl.Execute(buf, ingressCfgWithClientBodyBufferSize)
316313
t.Log(buf.String())
317314
if err != nil {
318315
t.Fatal(err)
@@ -2156,6 +2153,77 @@ var (
21562153
},
21572154
}
21582155

2156+
ingressCfgWithClientBodyBufferSize = IngressNginxConfig{
2157+
Servers: []Server{
2158+
{
2159+
Name: "test.example.com",
2160+
ServerTokens: "off",
2161+
StatusZone: "test.example.com",
2162+
JWTAuth: &JWTAuth{
2163+
Key: "/etc/nginx/secrets/key.jwk",
2164+
Realm: "closed site",
2165+
Token: "$cookie_auth_token",
2166+
RedirectLocationName: "@login_url-default-cafe-ingress",
2167+
},
2168+
SSL: true,
2169+
SSLCertificate: "secret.pem",
2170+
SSLCertificateKey: "secret.pem",
2171+
SSLPorts: []int{443},
2172+
SSLRedirect: true,
2173+
Locations: []Location{
2174+
{
2175+
Path: "/tea",
2176+
Upstream: testUpstream,
2177+
ProxyConnectTimeout: "10s",
2178+
ProxyReadTimeout: "10s",
2179+
ProxySendTimeout: "10s",
2180+
ClientMaxBodySize: "2m",
2181+
ClientBodyBufferSize: "16k",
2182+
JWTAuth: &JWTAuth{
2183+
Key: "/etc/nginx/secrets/location-key.jwk",
2184+
Realm: "closed site",
2185+
Token: "$cookie_auth_token",
2186+
},
2187+
MinionIngress: &Ingress{
2188+
Name: "tea-minion",
2189+
Namespace: "default",
2190+
},
2191+
},
2192+
},
2193+
HealthChecks: map[string]HealthCheck{"test": healthCheck},
2194+
JWTRedirectLocations: []JWTRedirectLocation{
2195+
{
2196+
Name: "@login_url-default-cafe-ingress",
2197+
LoginURL: "https://test.example.com/login",
2198+
},
2199+
},
2200+
AppProtectEnable: "on",
2201+
AppProtectPolicy: "/etc/nginx/waf/nac-policies/default-dataguard-alarm",
2202+
AppProtectLogConfs: []string{
2203+
"/etc/nginx/waf/nac-logconfs/test_logconf syslog:server=127.0.0.1:514",
2204+
"/etc/nginx/waf/nac-logconfs/test_logconf2",
2205+
},
2206+
AppProtectLogEnable: "on",
2207+
AppProtectDosEnable: "on",
2208+
AppProtectDosPolicyFile: "/test/policy.json",
2209+
AppProtectDosLogConfFile: "/test/logConf.json",
2210+
AppProtectDosLogEnable: true,
2211+
AppProtectDosMonitorURI: "/path/to/monitor",
2212+
AppProtectDosMonitorProtocol: "http1",
2213+
AppProtectDosMonitorTimeout: 30,
2214+
AppProtectDosName: "testdos",
2215+
AppProtectDosAccessLogDst: "/var/log/dos",
2216+
AppProtectDosAllowListPath: "/etc/nginx/dos/allowlist/default_test.example.com",
2217+
},
2218+
},
2219+
Upstreams: []Upstream{testUpstream},
2220+
Keepalive: "16",
2221+
Ingress: Ingress{
2222+
Name: "cafe-ingress",
2223+
Namespace: "default",
2224+
},
2225+
}
2226+
21592227
// Ingress Config example with path-regex annotation value "case_sensitive"
21602228
ingressCfgWithRegExAnnotationCaseSensitive = IngressNginxConfig{
21612229
Servers: []Server{

0 commit comments

Comments
 (0)