E582 fix rebase and revert policy · nginx/kubernetes-ingress@f1b6029 · GitHub
[go: up one dir, main page]

Skip to content

Commit f1b6029

Browse files
committed
fix rebase and revert policy
1 parent 9ecaf0b commit f1b6029

File tree

3 files changed

+7
-49
lines changed

3 files changed

+7
-49
lines changed

internal/k8s/validation_test.go

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,20 +1473,6 @@ func TestValidateNginxIngressAnnotations(t *testing.T) {
14731473
msg: "invalid nginx.com/jwt-key annotation, containing '_",
14741474
},
14751475

1476-
{
1477-
annotations: map[string]string{
1478-
"nginx.com/jwt-key": "my_jwk",
1479-
},
1480-
specServices: map[string]bool{},
1481-
isPlus: true,
1482-
appProtectEnabled: false,
1483-
appProtectDosEnabled: false,
1484-
internalRoutesEnabled: false,
1485-
expectedErrors: []string{
1486-
"annotations.nginx.com/jwt-key: Invalid value: \"my_jwk\": a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')",
1487-
},
1488-
msg: "invalid nginx.com/jwt-key annotation, containing '_",
1489-
},
14901476
{
14911477
annotations: map[string]string{
14921478
"nginx.com/jwt-token": "true",
@@ -1665,34 +1651,6 @@ func TestValidateNginxIngressAnnotations(t *testing.T) {
16651651
},
16661652
msg: "invalid nginx.com/jwt-login-url annotation, hostname missing",
16671653
},
1668-
{
1669-
annotations: map[string]string{
1670-
"nginx.com/jwt-login-url": "login.example.com",
1671-
},
1672-
specServices: map[string]bool{},
1673-
isPlus: true,
1674-
appProtectEnabled: false,
1675-
appProtectDosEnabled: false,
1676-
internalRoutesEnabled: false,
1677-
expectedErrors: []string{
1678-
"annotations.nginx.com/jwt-login-url: Invalid value: \"login.example.com\": scheme required, please use the prefix http(s)://",
1679-
},
1680-
msg: "invalid nginx.com/jwt-login-url annotation, scheme missing",
1681-
},
1682-
{
1683-
annotations: map[string]string{
1684-
"nginx.com/jwt-login-url": "http:",
1685-
},
1686-
specServices: map[string]bool{},
1687-
isPlus: true,
1688-
appProtectEnabled: false,
1689-
appProtectDosEnabled: false,
1690-
internalRoutesEnabled: false,
1691-
expectedErrors: []string{
1692-
"annotations.nginx.com/jwt-login-url: Invalid value: \"http:\": hostname required",
1693-
},
1694-
msg: "invalid nginx.com/jwt-login-url annotation, hostname missing",
1695-
},
16961654

16971655
{
16981656
annotations: map[string]string{

pkg/apis/configuration/validation/policy.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ func validateJWT(jwt *v1.JWTAuth, fieldPath *field.Path) field.ErrorList {
155155
}
156156
allErrs = append(allErrs, validateSecretName(jwt.Secret, fieldPath.Child("secret"))...)
157157
158-
allErrs = append(allErrs, ValidateJWTToken(jwt.Token, fieldPath.Child("token"))...)
158+
allErrs = append(allErrs, validateJWTToken(jwt.Token, fieldPath.Child("token"))...)
159159

160160
return allErrs
161161
}
@@ -450,7 +450,7 @@ func validateRateLimitKey(key string, fieldPath *field.Path, isPlus bool) field.
450450

451451
var jwtTokenSpecialVariables = []string{"arg_", "http_", "cookie_"}
452452

453-
func ValidateJWTToken(token string, fieldPath *field.Path) field.ErrorList {
453+
func validateJWTToken(token string, fieldPath *field.Path) field.ErrorList {
454454
allErrs := field.ErrorList{}
455455

456456
if token == "" {
@@ -472,7 +472,7 @@ func ValidateJWTToken(token string, fieldPath *field.Path) field.ErrorList {
472472
}
473473

474474
if special {
475-
// ValidateJWTToken is called only when NGINX Plus is running
475+
// validateJWTToken is called only when NGINX Plus is running
476476
isPlus := true
477477
allErrs = append(allErrs, validateSpecialVariable(nVar, fieldPath, isPlus)...)
478478
} else {

pkg/apis/configuration/validation/policy_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -640,9 +640,9 @@ func TestValidateJWTToken(t *testing.T) {
640640
},
641641
}
642642
for _, test := range validTests {
643-
allErrs := ValidateJWTToken(test.token, field.NewPath("token"))
643+
allErrs := validateJWTToken(test.token, field.NewPath("token"))
644644
if len(allErrs) != 0 {
645-
t.Errorf("ValidateJWTToken(%v) returned an error for valid input for the case of %v", test.token, test.msg)
645+
t.Errorf("validateJWTToken(%v) returned an error for valid input for the case of %v", test.token, test.msg)
646646
}
647647
}
648648

@@ -672,9 +672,9 @@ func TestValidateJWTToken(t *testing.T) {
672672
},
673673
}
674674
for _, test := range invalidTests {
675-
allErrs := ValidateJWTToken(test.token, field.NewPath("token"))
675+
allErrs := validateJWTToken(test.token, field.NewPath("token"))
676676
if len(allErrs) == 0 {
677-
t.Errorf("ValidateJWTToken(%v) didn't return error for invalid input for the case of %v", test.token, test.msg)
677+
t.Errorf("validateJWTToken(%v) didn't return error for invalid input for the case of %v", test.token, test.msg)
678678
}
679679
}
680680
}

0 commit comments

Comments
 (0)
0