Skip to content

Commit e5a07ea

Browse files
committed
address comments by resorting to nginx default due to different archs
1 parent c6ad9d7 commit e5a07ea

File tree

6 files changed

+25
-84
lines changed

6 files changed

+25
-84
lines changed

examples/custom-resources/basic-configuration/cafe-virtual-server.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ spec:
1010
- name: tea
1111
service: tea-svc
1212
port: 80
13+
client-body-buffer-size: 123.ie
1314
- name: coffee
1415
service: coffee-svc
1516
port: 80
17+
client-body-buffer-size: 12k
1618
routes:
1719
- path: /tea
1820
action:

internal/configs/config_params.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,6 @@ func NewDefaultConfigParams(ctx context.Context, isPlus bool) *ConfigParams {
249249
MainServerNamesHashMaxSize: "1024",
250250
MainMapHashBucketSize: "256",
251251
MainMapHashMaxSize: "2048",
252-
MainClientBodyBufferSize: "8k",
253252
ProxyBuffering: true,
254253
MainWorkerProcesses: "auto",
255254
MainWorkerConnections: "1024",

internal/configs/configmaps_test.go

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2529,10 +2529,10 @@ func TestParseConfigMapClientBodyBufferSizeValid(t *testing.T) {
25292529
description: "should accept valid size without suffix",
25302530
},
25312531
{
2532-
name: "default when not set",
2532+
name: "not set",
25332533
value: "",
2534-
expected: "8k", // default value from config_params.go
2535-
description: "should use default when not set",
2534+
expected: "", // no default value anymore
2535+
description: "should use empty string when not set",
25362536
},
25372537
}
25382538

@@ -2542,9 +2542,8 @@ func TestParseConfigMapClientBodyBufferSizeValid(t *testing.T) {
25422542
hasTLSPassthrough := false
25432543
directiveAutoadjustEnabled := false
25442544

2545-
for _, test := range tests {
2546-
test := test // capture range variable
2547-
t.Run(test.name, func(t *testing.T) {
2545+
for _, tt := range tests {
2546+
t.Run(tt.name, func(t *testing.T) {
25482547
t.Parallel()
25492548

25502549
cm := &v1.ConfigMap{
@@ -2554,9 +2553,9 @@ func TestParseConfigMapClientBodyBufferSizeValid(t *testing.T) {
25542553
},
25552554
}
25562555

2557-
if test.value != "" {
2556+
if tt.value != "" {
25582557
cm.Data = map[string]string{
2559-
"client-body-buffer-size": test.value,
2558+
"client-body-buffer-size": tt.value,
25602559
}
25612560
}
25622561

@@ -2573,12 +2572,12 @@ func TestParseConfigMapClientBodyBufferSizeValid(t *testing.T) {
25732572

25742573
// Should always pass validation for valid cases
25752574
if !configOk {
2576-
t.Errorf("ParseConfigMap() for %s should have passed validation but failed", test.description)
2575+
t.Errorf("ParseConfigMap() for %s should have passed validation but failed", tt.description)
25772576
}
25782577

2579-
if result.MainClientBodyBufferSize != test.expected {
2578+
if result.MainClientBodyBufferSize != tt.expected {
25802579
t.Errorf("ParseConfigMap() for %s returned MainClientBodyBufferSize=%q, expected %q",
2581-
test.description, result.MainClientBodyBufferSize, test.expected)
2580+
tt.description, result.MainClientBodyBufferSize, tt.expected)
25822581
}
25832582
})
25842583
}
@@ -2645,9 +2644,8 @@ func TestParseConfigMapClientBodyBufferSizeInvalid(t *testing.T) {
26452644
hasTLSPassthrough := false
26462645
directiveAutoadjustEnabled := false
26472646

2648-
for _, test := range tests {
2649-
test := test // capture range variable
2650-
t.Run(test.name, func(t *testing.T) {
2647+
for _, tt := range tests {
2648+
t.Run(tt.name, func(t *testing.T) {
26512649
t.Parallel()
26522650

26532651
cm := &v1.ConfigMap{
@@ -2656,7 +2654,7 @@ func TestParseConfigMapClientBodyBufferSizeInvalid(t *testing.T) {
26562654
Namespace: "default",
26572655
},
26582656
Data: map[string]string{
2659-
"client-body-buffer-size": test.value,
2657+
"client-body-buffer-size": tt.value,
26602658
},
26612659
}
26622660

@@ -2673,14 +2671,12 @@ func TestParseConfigMapClientBodyBufferSizeInvalid(t *testing.T) {
26732671

26742672
// Should always fail validation for invalid cases
26752673
if configOk {
2676-
t.Errorf("ParseConfigMap() for %s should have failed validation but passed", test.description)
2674+
t.Errorf("%s should have failed validation but passed", tt.name)
26772675
}
26782676

2679-
// Should fall back to default value when validation fails
2680-
expectedDefault := "8k" // default from config_params.go
2681-
if result.MainClientBodyBufferSize != expectedDefault {
2682-
t.Errorf("ParseConfigMap() for %s returned MainClientBodyBufferSize=%q, expected default %q",
2683-
test.description, result.MainClientBodyBufferSize, expectedDefault)
2677+
if result.MainClientBodyBufferSize != "" {
2678+
t.Errorf(`%s returned MainClientBodyBufferSize=%q, expected ""`,
2679+
tt.name, result.MainClientBodyBufferSize)
26842680
}
26852681
})
26862682
}

0 commit comments

Comments
 (0)