Disable user snippets per default (#10393)

* Disable user snippets per default

* Enable snippet on tests
This commit is contained in:
Ricardo Katz 2023-09-11 00:02:10 -03:00 committed by GitHub
parent 2d03da6334
commit cf889c6c47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 494 additions and 288 deletions

View file

@ -32,7 +32,7 @@ import (
const (
fastCGIIndexAnnotation = "fastcgi-index"
fastCGIParamsAnnotation = "fastcgi-params-configmap"
fastCGIParamsAnnotation = "fastcgi-params-configmap" //#nosec G101
)
// fast-cgi valid parameters is just a single file name (like index.php)

View file

@ -67,7 +67,7 @@ func TestParse(t *testing.T) {
Spec: networking.IngressSpec{},
}
for _, testCase := range testCases {
for i, testCase := range testCases {
ing.SetAnnotations(testCase.annotations)
result, err := ap.Parse(ing)
if err != nil {
@ -77,7 +77,7 @@ func TestParse(t *testing.T) {
if !ok {
t.Errorf("unexpected type: %T", result)
}
if !config.Equal(&testCase.expected) {
if !config.Equal(&testCases[i].expected) {
t.Errorf("expected %v but returned %v, annotations: %s", testCase.expected, result, testCase.annotations)
}
}

View file

@ -42,7 +42,7 @@ const (
proxyRedirectToAnnotation = "proxy-redirect-to"
proxyBufferingAnnotation = "proxy-buffering"
proxyHTTPVersionAnnotation = "proxy-http-version"
proxyMaxTempFileSizeAnnotation = "proxy-max-temp-file-size"
proxyMaxTempFileSizeAnnotation = "proxy-max-temp-file-size" //#nosec G101
)
var validUpstreamAnnotation = regexp.MustCompile(`^((error|timeout|invalid_header|http_500|http_502|http_503|http_504|http_403|http_404|http_429|non_idempotent|off)\s?)+$`)

View file

@ -64,13 +64,13 @@ func TestParse(t *testing.T) {
Spec: networking.IngressSpec{},
}
for _, testCase := range testCases {
for i, testCase := range testCases {
ing.SetAnnotations(testCase.annotations)
result, err := ap.Parse(ing)
if (err != nil) != testCase.expectErr {
t.Fatalf("expected error: %t got error: %t err value: %s. %+v", testCase.expectErr, err != nil, err, testCase.annotations)
}
if !reflect.DeepEqual(result, &testCase.expected) {
if !reflect.DeepEqual(result, &testCases[i].expected) {
t.Errorf("expected %v but returned %v, annotations: %s", testCase.expected, result, testCase.annotations)
}
}