@@ -12,59 +12,6 @@ import (
12
12
"github.com/kong/kubernetes-ingress-controller/v3/internal/labels"
13
13
)
14
14
15
- func TestUniqueConstraintsValidation (t * testing.T ) {
16
- t .Log ("Setting up an index of existing credentials which have unique constraints" )
17
- index := make (Index )
18
- require .NoError (t , index .add (Credential {
19
- Key : "username" ,
20
- Value : "batman" ,
21
- Type : "basic-auth" ,
22
- }))
23
- require .NoError (t , index .add (Credential {
24
- Key : "username" ,
25
- Value : "robin" ,
26
- Type : "basic-auth" ,
27
- }))
28
-
29
- t .Log ("Verifying that a new basic-auth credential with a unique username doesn't violate constraints" )
30
- nonviolatingCredential := Credential {
31
- Key : "username" ,
32
- Value : "nightwing" ,
33
- Type : "basic-auth" ,
34
- }
35
- assert .NoError (t , index .add (nonviolatingCredential ))
36
-
37
- t .Log ("Verifying that a new basic-auth credential with a username that's already in use violates constraints" )
38
- violatingCredential := Credential {
39
- Key : "username" ,
40
- Value : "batman" ,
41
- Type : "basic-auth" ,
42
- }
43
- assert .True (t , IsKeyUniqueConstrained (violatingCredential .Type , violatingCredential .Key ))
44
- err := index .add (violatingCredential )
45
- assert .Error (t , err )
46
-
47
- t .Log ("Setting up a list of existing credentials which have no unique constraints" )
48
- index = make (Index )
49
- assert .NoError (t , index .add (Credential {
50
- Key : "key" ,
51
- Value : "test" ,
52
- Type : "acl" ,
53
- }))
54
-
55
- t .Log ("Verifying that non-unique constrained credentials don't trigger a violation" )
56
- duplicate := Credential {
57
- Key : "key" ,
58
- Value : "test" ,
59
- Type : "acl" ,
60
- }
61
- assert .False (t , IsKeyUniqueConstrained (duplicate .Type , duplicate .Key ))
62
- assert .NoError (t , index .add (duplicate ))
63
-
64
- t .Log ("Verifying that unconstrained keys for types with constraints don't flag as violated" )
65
- assert .False (t , IsKeyUniqueConstrained ("basic-auth" , "unconstrained-key" ))
66
- }
67
-
68
15
func TestValidateCredentials (t * testing.T ) {
69
16
tests := []struct {
70
17
name string
0 commit comments