@@ -25,23 +25,24 @@ package v1alpha
2525import (
2626 "testing"
2727
28+ "github.com/arangodb/kube-arangodb/pkg/util"
2829 "github.com/stretchr/testify/assert"
2930)
3031
3132func TestAuthenticationSpecValidate (t * testing.T ) {
3233 // Valid
33- assert .Nil (t , AuthenticationSpec {JWTSecretName : "None" }.Validate (false ))
34- assert .Nil (t , AuthenticationSpec {JWTSecretName : "foo" }.Validate (false ))
35- assert .Nil (t , AuthenticationSpec {JWTSecretName : "foo" }.Validate (true ))
34+ assert .Nil (t , AuthenticationSpec {JWTSecretName : util . NewString ( "None" ) }.Validate (false ))
35+ assert .Nil (t , AuthenticationSpec {JWTSecretName : util . NewString ( "foo" ) }.Validate (false ))
36+ assert .Nil (t , AuthenticationSpec {JWTSecretName : util . NewString ( "foo" ) }.Validate (true ))
3637
3738 // Not valid
38- assert .Error (t , AuthenticationSpec {JWTSecretName : "Foo" }.Validate (false ))
39+ assert .Error (t , AuthenticationSpec {JWTSecretName : util . NewString ( "Foo" ) }.Validate (false ))
3940}
4041
4142func TestAuthenticationSpecIsAuthenticated (t * testing.T ) {
42- assert .False (t , AuthenticationSpec {JWTSecretName : "None" }.IsAuthenticated ())
43- assert .True (t , AuthenticationSpec {JWTSecretName : "foo" }.IsAuthenticated ())
44- assert .True (t , AuthenticationSpec {JWTSecretName : "" }.IsAuthenticated ())
43+ assert .False (t , AuthenticationSpec {JWTSecretName : util . NewString ( "None" ) }.IsAuthenticated ())
44+ assert .True (t , AuthenticationSpec {JWTSecretName : util . NewString ( "foo" ) }.IsAuthenticated ())
45+ assert .True (t , AuthenticationSpec {JWTSecretName : util . NewString ( "" ) }.IsAuthenticated ())
4546}
4647
4748func TestAuthenticationSpecSetDefaults (t * testing.T ) {
@@ -50,8 +51,8 @@ func TestAuthenticationSpecSetDefaults(t *testing.T) {
5051 return spec
5152 }
5253
53- assert .Equal (t , "test-jwt" , def (AuthenticationSpec {}).JWTSecretName )
54- assert .Equal (t , "foo" , def (AuthenticationSpec {JWTSecretName : "foo" }).JWTSecretName )
54+ assert .Equal (t , "test-jwt" , def (AuthenticationSpec {}).GetJWTSecretName () )
55+ assert .Equal (t , "foo" , def (AuthenticationSpec {JWTSecretName : util . NewString ( "foo" ) }).GetJWTSecretName () )
5556}
5657
5758func TestAuthenticationSpecResetImmutableFields (t * testing.T ) {
@@ -63,35 +64,35 @@ func TestAuthenticationSpecResetImmutableFields(t *testing.T) {
6364 }{
6465 // Valid "changes"
6566 {
66- AuthenticationSpec {JWTSecretName : "None" },
67- AuthenticationSpec {JWTSecretName : "None" },
68- AuthenticationSpec {JWTSecretName : "None" },
67+ AuthenticationSpec {JWTSecretName : util . NewString ( "None" ) },
68+ AuthenticationSpec {JWTSecretName : util . NewString ( "None" ) },
69+ AuthenticationSpec {JWTSecretName : util . NewString ( "None" ) },
6970 nil ,
7071 },
7172 {
72- AuthenticationSpec {JWTSecretName : "foo" },
73- AuthenticationSpec {JWTSecretName : "foo" },
74- AuthenticationSpec {JWTSecretName : "foo" },
73+ AuthenticationSpec {JWTSecretName : util . NewString ( "foo" ) },
74+ AuthenticationSpec {JWTSecretName : util . NewString ( "foo" ) },
75+ AuthenticationSpec {JWTSecretName : util . NewString ( "foo" ) },
7576 nil ,
7677 },
7778 {
78- AuthenticationSpec {JWTSecretName : "foo" },
79- AuthenticationSpec {JWTSecretName : "foo2" },
80- AuthenticationSpec {JWTSecretName : "foo2" },
79+ AuthenticationSpec {JWTSecretName : util . NewString ( "foo" ) },
80+ AuthenticationSpec {JWTSecretName : util . NewString ( "foo2" ) },
81+ AuthenticationSpec {JWTSecretName : util . NewString ( "foo2" ) },
8182 nil ,
8283 },
8384
8485 // Invalid changes
8586 {
86- AuthenticationSpec {JWTSecretName : "foo" },
87- AuthenticationSpec {JWTSecretName : "None" },
88- AuthenticationSpec {JWTSecretName : "foo" },
87+ AuthenticationSpec {JWTSecretName : util . NewString ( "foo" ) },
88+ AuthenticationSpec {JWTSecretName : util . NewString ( "None" ) },
89+ AuthenticationSpec {JWTSecretName : util . NewString ( "foo" ) },
8990 []string {"test.jwtSecretName" },
9091 },
9192 {
92- AuthenticationSpec {JWTSecretName : "None" },
93- AuthenticationSpec {JWTSecretName : "foo" },
94- AuthenticationSpec {JWTSecretName : "None" },
93+ AuthenticationSpec {JWTSecretName : util . NewString ( "None" ) },
94+ AuthenticationSpec {JWTSecretName : util . NewString ( "foo" ) },
95+ AuthenticationSpec {JWTSecretName : util . NewString ( "None" ) },
9596 []string {"test.jwtSecretName" },
9697 },
9798 }
0 commit comments