@@ -10,6 +10,7 @@ import (
10
10
11
11
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1alpha"
12
12
"github.com/arangodb/kube-arangodb/pkg/client"
13
+ "github.com/arangodb/kube-arangodb/pkg/util"
13
14
"github.com/arangodb/kube-arangodb/pkg/util/arangod"
14
15
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
15
16
)
@@ -24,7 +25,7 @@ func TestAuthenticationSingleDefaultSecret(t *testing.T) {
24
25
25
26
// Prepare deployment config
26
27
depl := newDeployment ("test-auth-sng-def-" + uniuri .NewLen (4 ))
27
- depl .Spec .Mode = api .DeploymentModeSingle
28
+ depl .Spec .Mode = api .NewMode ( api . DeploymentModeSingle )
28
29
depl .Spec .SetDefaults (depl .GetName ())
29
30
30
31
// Create deployment
@@ -39,7 +40,7 @@ func TestAuthenticationSingleDefaultSecret(t *testing.T) {
39
40
}
40
41
41
42
// Secret must now exist
42
- if _ , err := waitUntilSecret (kubecli , depl .Spec .Authentication .JWTSecretName , ns , nil , time .Second ); err != nil {
43
+ if _ , err := waitUntilSecret (kubecli , depl .Spec .Authentication .GetJWTSecretName () , ns , nil , time .Second ); err != nil {
43
44
t .Fatalf ("JWT secret '%s' not found: %v" , depl .Spec .Authentication .JWTSecretName , err )
44
45
}
45
46
@@ -56,7 +57,7 @@ func TestAuthenticationSingleDefaultSecret(t *testing.T) {
56
57
removeDeployment (c , depl .GetName (), ns )
57
58
58
59
// Secret must no longer exist
59
- if err := waitUntilSecretNotFound (kubecli , depl .Spec .Authentication .JWTSecretName , ns , time .Minute ); err != nil {
60
+ if err := waitUntilSecretNotFound (kubecli , depl .Spec .Authentication .GetJWTSecretName () , ns , time .Minute ); err != nil {
60
61
t .Fatalf ("JWT secret '%s' still found: %v" , depl .Spec .Authentication .JWTSecretName , err )
61
62
}
62
63
}
@@ -71,12 +72,12 @@ func TestAuthenticationSingleCustomSecret(t *testing.T) {
71
72
72
73
// Prepare deployment config
73
74
depl := newDeployment ("test-auth-sng-cst-" + uniuri .NewLen (4 ))
74
- depl .Spec .Mode = api .DeploymentModeSingle
75
- depl .Spec .Authentication .JWTSecretName = strings .ToLower (uniuri .New ())
75
+ depl .Spec .Mode = api .NewMode ( api . DeploymentModeSingle )
76
+ depl .Spec .Authentication .JWTSecretName = util . NewString ( strings .ToLower (uniuri .New () ))
76
77
depl .Spec .SetDefaults (depl .GetName ())
77
78
78
79
// Create secret
79
- if err := k8sutil .CreateJWTSecret (kubecli .CoreV1 (), depl .Spec .Authentication .JWTSecretName , ns , "foo" , nil ); err != nil {
80
+ if err := k8sutil .CreateJWTSecret (kubecli .CoreV1 (), depl .Spec .Authentication .GetJWTSecretName () , ns , "foo" , nil ); err != nil {
80
81
t .Fatalf ("Create JWT secret failed: %v" , err )
81
82
}
82
83
@@ -104,12 +105,12 @@ func TestAuthenticationSingleCustomSecret(t *testing.T) {
104
105
removeDeployment (c , depl .GetName (), ns )
105
106
106
107
// Secret must still exist
107
- if _ , err := waitUntilSecret (kubecli , depl .Spec .Authentication .JWTSecretName , ns , nil , time .Second ); err != nil {
108
+ if _ , err := waitUntilSecret (kubecli , depl .Spec .Authentication .GetJWTSecretName () , ns , nil , time .Second ); err != nil {
108
109
t .Fatalf ("JWT secret '%s' not found: %v" , depl .Spec .Authentication .JWTSecretName , err )
109
110
}
110
111
111
112
// Cleanup secret
112
- removeSecret (kubecli , depl .Spec .Authentication .JWTSecretName , ns )
113
+ removeSecret (kubecli , depl .Spec .Authentication .GetJWTSecretName () , ns )
113
114
}
114
115
115
116
// TestAuthenticationNoneSingle creating a single server
@@ -122,8 +123,8 @@ func TestAuthenticationNoneSingle(t *testing.T) {
122
123
123
124
// Prepare deployment config
124
125
depl := newDeployment ("test-auth-none-sng-" + uniuri .NewLen (4 ))
125
- depl .Spec .Mode = api .DeploymentModeSingle
126
- depl .Spec .Authentication .JWTSecretName = api .JWTSecretNameDisabled
126
+ depl .Spec .Mode = api .NewMode ( api . DeploymentModeSingle )
127
+ depl .Spec .Authentication .JWTSecretName = util . NewString ( api .JWTSecretNameDisabled )
127
128
depl .Spec .SetDefaults (depl .GetName ())
128
129
129
130
// Create deployment
@@ -160,7 +161,7 @@ func TestAuthenticationClusterDefaultSecret(t *testing.T) {
160
161
161
162
// Prepare deployment config
162
163
depl := newDeployment ("test-auth-cls-def-" + uniuri .NewLen (4 ))
163
- depl .Spec .Mode = api .DeploymentModeCluster
164
+ depl .Spec .Mode = api .NewMode ( api . DeploymentModeCluster )
164
165
depl .Spec .SetDefaults (depl .GetName ())
165
166
166
167
// Create deployment
@@ -175,7 +176,7 @@ func TestAuthenticationClusterDefaultSecret(t *testing.T) {
175
176
}
176
177
177
178
// Secret must now exist
178
- if _ , err := waitUntilSecret (kubecli , depl .Spec .Authentication .JWTSecretName , ns , nil , time .Second ); err != nil {
179
+ if _ , err := waitUntilSecret (kubecli , depl .Spec .Authentication .GetJWTSecretName () , ns , nil , time .Second ); err != nil {
179
180
t .Fatalf ("JWT secret '%s' not found: %v" , depl .Spec .Authentication .JWTSecretName , err )
180
181
}
181
182
@@ -192,7 +193,7 @@ func TestAuthenticationClusterDefaultSecret(t *testing.T) {
192
193
removeDeployment (c , depl .GetName (), ns )
193
194
194
195
// Secret must no longer exist
195
- if err := waitUntilSecretNotFound (kubecli , depl .Spec .Authentication .JWTSecretName , ns , time .Minute ); err != nil {
196
+ if err := waitUntilSecretNotFound (kubecli , depl .Spec .Authentication .GetJWTSecretName () , ns , time .Minute ); err != nil {
196
197
t .Fatalf ("JWT secret '%s' still found: %v" , depl .Spec .Authentication .JWTSecretName , err )
197
198
}
198
199
}
@@ -207,12 +208,12 @@ func TestAuthenticationClusterCustomSecret(t *testing.T) {
207
208
208
209
// Prepare deployment config
209
210
depl := newDeployment ("test-auth-cls-cst-" + uniuri .NewLen (4 ))
210
- depl .Spec .Mode = api .DeploymentModeCluster
211
- depl .Spec .Authentication .JWTSecretName = strings .ToLower (uniuri .New ())
211
+ depl .Spec .Mode = api .NewMode ( api . DeploymentModeCluster )
212
+ depl .Spec .Authentication .JWTSecretName = util . NewString ( strings .ToLower (uniuri .New () ))
212
213
depl .Spec .SetDefaults (depl .GetName ())
213
214
214
215
// Create secret
215
- if err := k8sutil .CreateJWTSecret (kubecli .CoreV1 (), depl .Spec .Authentication .JWTSecretName , ns , "foo" , nil ); err != nil {
216
+ if err := k8sutil .CreateJWTSecret (kubecli .CoreV1 (), depl .Spec .Authentication .GetJWTSecretName () , ns , "foo" , nil ); err != nil {
216
217
t .Fatalf ("Create JWT secret failed: %v" , err )
217
218
}
218
219
@@ -240,12 +241,12 @@ func TestAuthenticationClusterCustomSecret(t *testing.T) {
240
241
removeDeployment (c , depl .GetName (), ns )
241
242
242
243
// Secret must still exist
243
- if _ , err := waitUntilSecret (kubecli , depl .Spec .Authentication .JWTSecretName , ns , nil , time .Second ); err != nil {
244
+ if _ , err := waitUntilSecret (kubecli , depl .Spec .Authentication .GetJWTSecretName () , ns , nil , time .Second ); err != nil {
244
245
t .Fatalf ("JWT secret '%s' not found: %v" , depl .Spec .Authentication .JWTSecretName , err )
245
246
}
246
247
247
248
// Cleanup secret
248
- removeSecret (kubecli , depl .Spec .Authentication .JWTSecretName , ns )
249
+ removeSecret (kubecli , depl .Spec .Authentication .GetJWTSecretName () , ns )
249
250
}
250
251
251
252
// TestAuthenticationNoneCluster creating a cluster
@@ -258,8 +259,8 @@ func TestAuthenticationNoneCluster(t *testing.T) {
258
259
259
260
// Prepare deployment config
260
261
depl := newDeployment ("test-auth-none-cls-" + uniuri .NewLen (4 ))
261
- depl .Spec .Mode = api .DeploymentModeCluster
262
- depl .Spec .Authentication .JWTSecretName = api .JWTSecretNameDisabled
262
+ depl .Spec .Mode = api .NewMode ( api . DeploymentModeCluster )
263
+ depl .Spec .Authentication .JWTSecretName = util . NewString ( api .JWTSecretNameDisabled )
263
264
depl .Spec .SetDefaults (depl .GetName ())
264
265
265
266
// Create deployment
0 commit comments