Skip to content

Commit

Permalink
Add non-alphanumeric input validation test for vpcID
Browse files Browse the repository at this point in the history
  • Loading branch information
shraddhabang committed May 9, 2024
1 parent 3bbfb9d commit 531c5c0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions webhooks/elbv2/targetgroupbinding_validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1136,6 +1136,18 @@ func Test_targetGroupBindingValidator_checkTargetGroupVpcID(t *testing.T) {
},
wantErr: errors.New("ValidationError: vpcID vpcid-123 failed to satisfy constraint: VPC Id must begin with 'vpc-' followed by 8 or 17 lowercase letters (a-f) or numbers."),
},
{
name: "[err] vpcID is not valid - non alphanumeric value",
args: args{
obj: &elbv2api.TargetGroupBinding{
Spec: elbv2api.TargetGroupBindingSpec{
TargetGroupARN: "tg-2",
VpcID: "vpcid-@34!dv",
},
},
},
wantErr: errors.New("ValidationError: vpcID vpcid-@34!dv failed to satisfy constraint: VPC Id must begin with 'vpc-' followed by 8 or 17 lowercase letters (a-f) or numbers."),
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit 531c5c0

Please sign in to comment.