update test params

Signed-off-by: James Strong <strong.james.e@gmail.com>
This commit is contained in:
James Strong 2023-01-31 15:13:07 -05:00
parent d96a8be4df
commit fe762d4bae
Failed to extract signature

View file

@ -249,23 +249,23 @@ func TestValidateIngressPath(t *testing.T) {
copyIng: generateDumbIngressforPathTest(&pathTypePrefix, ""), copyIng: generateDumbIngressforPathTest(&pathTypePrefix, ""),
}, },
{ {
name: "should deny path with bad characters and pathType not implementationSpecific", name: "should deny path with bad characters and pathType not implementationSpecific",
EnablePathTypeValidation: true, wantErr: true,
wantErr: true, additionalChars: "()",
additionalChars: "()", copyIng: generateDumbIngressforPathTest(&pathTypeExact, "/foo/bar/(.+)"),
copyIng: generateDumbIngressforPathTest(&pathTypeExact, "/foo/bar/(.+)"),
}, },
{ {
name: "should accept path with regex characters and pathType implementationSpecific", name: "should accept path with regex characters and pathType implementationSpecific",
wantErr: false, wantErr: false,
additionalChars: defaultAdditionalChars, additionalChars: defaultAdditionalChars,
copyIng: generateDumbIngressforPathTest(&pathTypeImplSpecific, "/foo/bar/(.+)"), EnablePathTypeValidation: false,
copyIng: generateDumbIngressforPathTest(&pathTypeImplSpecific, "/foo/bar/(.+)"),
}, },
{ {
name: "should accept path with regex characters and pathType exact, but pathType validation disabled", name: "should accept path with regex characters and pathType exact, but pathType validation disabled",
wantErr: false, wantErr: false,
additionalChars: defaultAdditionalChars, additionalChars: defaultAdditionalChars,
EnablePathTypeValidation: true, EnablePathTypeValidation: false,
copyIng: generateDumbIngressforPathTest(&pathTypeExact, "/foo/bar/(.+)"), copyIng: generateDumbIngressforPathTest(&pathTypeExact, "/foo/bar/(.+)"),
}, },
{ {
@ -276,20 +276,23 @@ func TestValidateIngressPath(t *testing.T) {
copyIng: generateDumbIngressforPathTest(&pathTypeImplSpecific, "/foo/bar/(.+)"), copyIng: generateDumbIngressforPathTest(&pathTypeImplSpecific, "/foo/bar/(.+)"),
}, },
{ {
name: "should accept path when the allowed additional set does match", name: "should accept path when the allowed additional set does match",
wantErr: false, wantErr: false,
additionalChars: "().?", additionalChars: "().?",
copyIng: generateDumbIngressforPathTest(&pathTypeImplSpecific, "/foo/bar/(.?)"), EnablePathTypeValidation: false,
copyIng: generateDumbIngressforPathTest(&pathTypeImplSpecific, "/foo/bar/(.?)"),
}, },
{ {
name: "should block if at least one path is bad", name: "should block if at least one path is bad",
wantErr: true, wantErr: true,
copyIng: generateComplexIngress(generateDumbIngressforPathTest(&pathTypeExact, "/foo/bar/(.?)")), EnablePathTypeValidation: false,
copyIng: generateComplexIngress(generateDumbIngressforPathTest(&pathTypeExact, "/foo/bar/(.?)")),
}, },
{ {
name: "should block if at least one path is bad", name: "should block if at least one path is bad",
wantErr: true, wantErr: true,
copyIng: generateComplexIngress(generateDumbIngressforPathTest(&pathTypeImplSpecific, "/foo/bar/(.?)")), EnablePathTypeValidation: false,
copyIng: generateComplexIngress(generateDumbIngressforPathTest(&pathTypeImplSpecific, "/foo/bar/(.?)")),
}, },
} }
for _, tt := range tests { for _, tt := range tests {