@@ -32,7 +32,7 @@ import (
32
32
33
33
func TestSyncSpecValidate (t * testing.T ) {
34
34
// Valid
35
- auth := AuthenticationSpec {JWTSecretName : util .NewString ("foo" )}
35
+ auth := SyncAuthenticationSpec {JWTSecretName : util .NewString ("foo" ), ClientCASecretName : util . NewString ( "foo-client " )}
36
36
tls := TLSSpec {CASecretName : util .NewString ("None" )}
37
37
assert .Nil (t , SyncSpec {Image : util .NewString ("foo" ), Authentication : auth }.Validate (DeploymentModeSingle ))
38
38
assert .Nil (t , SyncSpec {Image : util .NewString ("foo" ), Authentication : auth }.Validate (DeploymentModeActiveFailover ))
@@ -49,7 +49,7 @@ func TestSyncSpecValidate(t *testing.T) {
49
49
50
50
func TestSyncSpecSetDefaults (t * testing.T ) {
51
51
def := func (spec SyncSpec ) SyncSpec {
52
- spec .SetDefaults ("test-image" , v1 .PullAlways , "test-jwt" , "test-ca" )
52
+ spec .SetDefaults ("test-image" , v1 .PullAlways , "test-jwt" , "test-client-auth-ca" , "test-tls- ca" )
53
53
return spec
54
54
}
55
55
@@ -61,7 +61,7 @@ func TestSyncSpecSetDefaults(t *testing.T) {
61
61
assert .Equal (t , v1 .PullAlways , def (SyncSpec {}).GetImagePullPolicy ())
62
62
assert .Equal (t , v1 .PullNever , def (SyncSpec {ImagePullPolicy : util .NewPullPolicy (v1 .PullNever )}).GetImagePullPolicy ())
63
63
assert .Equal (t , "test-jwt" , def (SyncSpec {}).Authentication .GetJWTSecretName ())
64
- assert .Equal (t , "foo" , def (SyncSpec {Authentication : AuthenticationSpec {JWTSecretName : util .NewString ("foo" )}}).Authentication .GetJWTSecretName ())
64
+ assert .Equal (t , "foo" , def (SyncSpec {Authentication : SyncAuthenticationSpec {JWTSecretName : util .NewString ("foo" )}}).Authentication .GetJWTSecretName ())
65
65
}
66
66
67
67
func TestSyncSpecResetImmutableFields (t * testing.T ) {
@@ -97,37 +97,23 @@ func TestSyncSpecResetImmutableFields(t *testing.T) {
97
97
nil ,
98
98
},
99
99
{
100
- SyncSpec {Authentication : AuthenticationSpec {JWTSecretName : util .NewString ("None" )}},
101
- SyncSpec {Authentication : AuthenticationSpec {JWTSecretName : util .NewString ("None" )}},
102
- SyncSpec {Authentication : AuthenticationSpec {JWTSecretName : util .NewString ("None" )}},
100
+ SyncSpec {Authentication : SyncAuthenticationSpec {JWTSecretName : util .NewString ("None" ), ClientCASecretName : util . NewString ( "some " )}},
101
+ SyncSpec {Authentication : SyncAuthenticationSpec {JWTSecretName : util .NewString ("None" ), ClientCASecretName : util . NewString ( "some " )}},
102
+ SyncSpec {Authentication : SyncAuthenticationSpec {JWTSecretName : util .NewString ("None" ), ClientCASecretName : util . NewString ( "some " )}},
103
103
nil ,
104
104
},
105
105
{
106
- SyncSpec {Authentication : AuthenticationSpec {JWTSecretName : util .NewString ("foo" )}},
107
- SyncSpec {Authentication : AuthenticationSpec {JWTSecretName : util .NewString ("foo" )}},
108
- SyncSpec {Authentication : AuthenticationSpec {JWTSecretName : util .NewString ("foo" )}},
106
+ SyncSpec {Authentication : SyncAuthenticationSpec {JWTSecretName : util .NewString ("foo" ), ClientCASecretName : util . NewString ( "some " )}},
107
+ SyncSpec {Authentication : SyncAuthenticationSpec {JWTSecretName : util .NewString ("foo" ), ClientCASecretName : util . NewString ( "some " )}},
108
+ SyncSpec {Authentication : SyncAuthenticationSpec {JWTSecretName : util .NewString ("foo" ), ClientCASecretName : util . NewString ( "some " )}},
109
109
nil ,
110
110
},
111
111
{
112
- SyncSpec {Authentication : AuthenticationSpec {JWTSecretName : util .NewString ("foo" )}},
113
- SyncSpec {Authentication : AuthenticationSpec {JWTSecretName : util .NewString ("foo2" )}},
114
- SyncSpec {Authentication : AuthenticationSpec {JWTSecretName : util .NewString ("foo2" )}},
112
+ SyncSpec {Authentication : SyncAuthenticationSpec {JWTSecretName : util .NewString ("foo" ), ClientCASecretName : util . NewString ( "some " )}},
113
+ SyncSpec {Authentication : SyncAuthenticationSpec {JWTSecretName : util .NewString ("foo2" ), ClientCASecretName : util . NewString ( "some " )}},
114
+ SyncSpec {Authentication : SyncAuthenticationSpec {JWTSecretName : util .NewString ("foo2" ), ClientCASecretName : util . NewString ( "some " )}},
115
115
nil ,
116
116
},
117
-
118
- // Invalid changes
119
- {
120
- SyncSpec {Authentication : AuthenticationSpec {JWTSecretName : util .NewString ("foo" )}},
121
- SyncSpec {Authentication : AuthenticationSpec {JWTSecretName : util .NewString ("None" )}},
122
- SyncSpec {Authentication : AuthenticationSpec {JWTSecretName : util .NewString ("foo" )}},
123
- []string {"test.auth.jwtSecretName" },
124
- },
125
- {
126
- SyncSpec {Authentication : AuthenticationSpec {JWTSecretName : util .NewString ("None" )}},
127
- SyncSpec {Authentication : AuthenticationSpec {JWTSecretName : util .NewString ("foo" )}},
128
- SyncSpec {Authentication : AuthenticationSpec {JWTSecretName : util .NewString ("None" )}},
129
- []string {"test.auth.jwtSecretName" },
130
- },
131
117
}
132
118
133
119
for _ , test := range tests {
0 commit comments