fix disableOnEtagHeader can't work in configmap gzip envoyfiler (#731)

This commit is contained in:
Jun
2023-12-25 11:55:04 +08:00
committed by GitHub
parent 10f5267b3f
commit 688247f4f9
2 changed files with 54 additions and 23 deletions

View File

@@ -277,27 +277,54 @@ func Test_deepCopyGzip(t *testing.T) {
wantErr error
}{
{
name: "deep copy",
name: "deep copy case 1",
gzip: &Gzip{
Enable: false,
MinContentLength: 1024,
ContentType: []string{"text/html", "text/css", "text/plain", "text/xml", "application/json", "application/javascript", "application/xhtml+xml", "image/svg+xml"},
DisableOnEtagHeader: true,
MemoryLevel: 5,
WindowBits: 12,
MinContentLength: 102,
ContentType: []string{"text/css", "text/plain", "text/xml", "application/json", "application/javascript", "application/xhtml+xml", "image/svg+xml"},
DisableOnEtagHeader: false,
MemoryLevel: 6,
WindowBits: 11,
ChunkSize: 4096,
CompressionLevel: "BEST_COMPRESSION",
CompressionLevel: "BEST_SPEED",
CompressionStrategy: "DEFAULT_STRATEGY",
},
wantGzip: &Gzip{
Enable: false,
MinContentLength: 1024,
ContentType: []string{"text/html", "text/css", "text/plain", "text/xml", "application/json", "application/javascript", "application/xhtml+xml", "image/svg+xml"},
DisableOnEtagHeader: true,
MemoryLevel: 5,
WindowBits: 12,
MinContentLength: 102,
ContentType: []string{"text/css", "text/plain", "text/xml", "application/json", "application/javascript", "application/xhtml+xml", "image/svg+xml"},
DisableOnEtagHeader: false,
MemoryLevel: 6,
WindowBits: 11,
ChunkSize: 4096,
CompressionLevel: "BEST_COMPRESSION",
CompressionLevel: "BEST_SPEED",
CompressionStrategy: "DEFAULT_STRATEGY",
},
wantErr: nil,
},
{
name: "deep copy case 2",
gzip: &Gzip{
Enable: true,
MinContentLength: 102,
ContentType: []string{"text/css", "text/plain", "text/xml", "application/json", "application/javascript", "application/xhtml+xml", "image/svg+xml"},
DisableOnEtagHeader: true,
MemoryLevel: 6,
WindowBits: 11,
ChunkSize: 4096,
CompressionLevel: "BEST_SPEED",
CompressionStrategy: "DEFAULT_STRATEGY",
},
wantGzip: &Gzip{
Enable: true,
MinContentLength: 102,
ContentType: []string{"text/css", "text/plain", "text/xml", "application/json", "application/javascript", "application/xhtml+xml", "image/svg+xml"},
DisableOnEtagHeader: true,
MemoryLevel: 6,
WindowBits: 11,
ChunkSize: 4096,
CompressionLevel: "BEST_SPEED",
CompressionStrategy: "DEFAULT_STRATEGY",
},
wantErr: nil,