Skip to content

Commit 46964d9

Browse files
committed
Added fakes for ValidateSslPolicy function
1 parent f504762 commit 46964d9

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

pkg/annotations/annotations_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func TestSetSslPolicy(t *testing.T) {
126126
for _, tt := range tests {
127127
a := &Annotations{}
128128

129-
err := a.setSslPolicy(map[string]string{sslPolicyKey: tt.SslPolicy})
129+
err := a.setSslPolicy(map[string]string{sslPolicyKey: tt.SslPolicy}, fakeValidator())
130130
if err != nil && tt.pass {
131131
t.Errorf("setIpAddressType(%v): expected %v, actual %v", tt.SslPolicy, tt.pass, err)
132132
}

pkg/annotations/validation_fake.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ type FakeValidator struct {
88
ValidateInboundCidrsDelegate func() error
99
ValidateSchemeDelegate func() bool
1010
ValidateWafAclIdDelegate func() error
11+
ValidateSslPolicyDelegate func() error
1112
}
1213

1314
func (fv FakeValidator) ResolveVPCValidateSubnets(a *Annotations) error {
@@ -52,3 +53,10 @@ func (fv FakeValidator) ValidateWafAclId(a *Annotations) error {
5253
}
5354
return nil
5455
}
56+
57+
func (fv FakeValidator) ValidateSslPolicy(a *Annotations) error {
58+
if fv.ValidateSslPolicyDelegate != nil {
59+
return fv.ValidateSslPolicyDelegate()
60+
}
61+
return nil
62+
}

0 commit comments

Comments
 (0)