Skip to content

Commit 6a8c20e

Browse files
committed
adjust unit tests to new list of arguments
1 parent f9890cb commit 6a8c20e

File tree

4 files changed

+43
-23
lines changed

4 files changed

+43
-23
lines changed

pkg/deployment/resources/pod_creator_agent_args_test.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// DISCLAIMER
33
//
4-
// Copyright 2020 ArangoDB GmbH, Cologne, Germany
4+
// Copyright 2020-2021 ArangoDB GmbH, Cologne, Germany
55
//
66
// Licensed under the Apache License, Version 2.0 (the "License");
77
// you may not use this file except in compliance with the License.
@@ -18,11 +18,13 @@
1818
// Copyright holder is ArangoDB GmbH, Cologne, Germany
1919
//
2020
// Author Ewout Prangsma
21+
// Author Tomasz Mielech
2122
//
2223

2324
package resources
2425

2526
import (
27+
"path/filepath"
2628
"testing"
2729

2830
"github.com/arangodb/kube-arangodb/pkg/deployment/resources/inspector"
@@ -37,6 +39,8 @@ import (
3739

3840
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
3941
"github.com/arangodb/kube-arangodb/pkg/util"
42+
"github.com/arangodb/kube-arangodb/pkg/util/constants"
43+
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
4044
)
4145

4246
type inspectorMock interface {
@@ -89,6 +93,7 @@ func (i inspectorMockStruct) Get(t *testing.T) inspectorInterface.Inspector {
8993

9094
// TestCreateArangodArgsAgent tests createArangodArgs for agent.
9195
func TestCreateArangodArgsAgent(t *testing.T) {
96+
jwtSecretFile := filepath.Join(k8sutil.ClusterJWTSecretVolumeMountDir, constants.SecretKeyToken)
9297
// Default deployment
9398
{
9499
apiObject := &api.ArangoDeployment{
@@ -138,7 +143,7 @@ func TestCreateArangodArgsAgent(t *testing.T) {
138143
"--log.output=+",
139144
"--server.authentication=true",
140145
"--server.endpoint=ssl://[::]:8529",
141-
"--server.jwt-secret=$(ARANGOD_JWT_SECRET)",
146+
"--server.jwt-secret-keyfile=" + jwtSecretFile,
142147
"--server.statistics=false",
143148
"--server.storage-engine=rocksdb",
144149
"--ssl.ecdh-curve=",
@@ -199,7 +204,7 @@ func TestCreateArangodArgsAgent(t *testing.T) {
199204
"--log.output=+",
200205
"--server.authentication=true",
201206
"--server.endpoint=ssl://[::]:8529",
202-
"--server.jwt-secret=$(ARANGOD_JWT_SECRET)",
207+
"--server.jwt-secret-keyfile=" + jwtSecretFile,
203208
"--server.statistics=false",
204209
"--server.storage-engine=rocksdb",
205210
"--ssl.ecdh-curve=",
@@ -262,7 +267,7 @@ func TestCreateArangodArgsAgent(t *testing.T) {
262267
"--log.output=+",
263268
"--server.authentication=true",
264269
"--server.endpoint=tcp://[::]:8529",
265-
"--server.jwt-secret=$(ARANGOD_JWT_SECRET)",
270+
"--server.jwt-secret-keyfile=" + jwtSecretFile,
266271
"--server.statistics=false",
267272
"--server.storage-engine=rocksdb",
268273
},
@@ -380,7 +385,7 @@ func TestCreateArangodArgsAgent(t *testing.T) {
380385
"--log.output=+",
381386
"--server.authentication=true",
382387
"--server.endpoint=ssl://[::]:8529",
383-
"--server.jwt-secret=$(ARANGOD_JWT_SECRET)",
388+
"--server.jwt-secret-keyfile=" + jwtSecretFile,
384389
"--server.statistics=false",
385390
"--server.storage-engine=rocksdb",
386391
"--ssl.ecdh-curve=",

pkg/deployment/resources/pod_creator_coordinator_args_test.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// DISCLAIMER
33
//
4-
// Copyright 2020 ArangoDB GmbH, Cologne, Germany
4+
// Copyright 2020-2021 ArangoDB GmbH, Cologne, Germany
55
//
66
// Licensed under the Apache License, Version 2.0 (the "License");
77
// you may not use this file except in compliance with the License.
@@ -18,11 +18,13 @@
1818
// Copyright holder is ArangoDB GmbH, Cologne, Germany
1919
//
2020
// Author Ewout Prangsma
21+
// Author Tomasz Mielech
2122
//
2223

2324
package resources
2425

2526
import (
27+
"path/filepath"
2628
"testing"
2729

2830
"github.com/stretchr/testify/require"
@@ -34,10 +36,13 @@ import (
3436

3537
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
3638
"github.com/arangodb/kube-arangodb/pkg/util"
39+
"github.com/arangodb/kube-arangodb/pkg/util/constants"
40+
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
3741
)
3842

3943
// TestCreateArangodArgsCoordinator tests createArangodArgs for coordinator.
4044
func TestCreateArangodArgsCoordinator(t *testing.T) {
45+
jwtSecretFile := filepath.Join(k8sutil.ClusterJWTSecretVolumeMountDir, constants.SecretKeyToken)
4146
// Default deployment
4247
{
4348
apiObject := &api.ArangoDeployment{
@@ -85,7 +90,7 @@ func TestCreateArangodArgsCoordinator(t *testing.T) {
8590
"--log.output=+",
8691
"--server.authentication=true",
8792
"--server.endpoint=ssl://[::]:8529",
88-
"--server.jwt-secret=$(ARANGOD_JWT_SECRET)",
93+
"--server.jwt-secret-keyfile=" + jwtSecretFile,
8994
"--server.statistics=true",
9095
"--server.storage-engine=rocksdb",
9196
"--ssl.ecdh-curve=",
@@ -143,7 +148,7 @@ func TestCreateArangodArgsCoordinator(t *testing.T) {
143148
"--log.output=+",
144149
"--server.authentication=true",
145150
"--server.endpoint=ssl://[::]:8529",
146-
"--server.jwt-secret=$(ARANGOD_JWT_SECRET)",
151+
"--server.jwt-secret-keyfile=" + jwtSecretFile,
147152
"--server.statistics=true",
148153
"--server.storage-engine=rocksdb",
149154
"--ssl.ecdh-curve=",
@@ -261,7 +266,7 @@ func TestCreateArangodArgsCoordinator(t *testing.T) {
261266
"--log.output=+",
262267
"--server.authentication=true",
263268
"--server.endpoint=tcp://[::]:8529",
264-
"--server.jwt-secret=$(ARANGOD_JWT_SECRET)",
269+
"--server.jwt-secret-keyfile=" + jwtSecretFile,
265270
"--server.statistics=true",
266271
"--server.storage-engine=rocksdb",
267272
},
@@ -375,7 +380,7 @@ func TestCreateArangodArgsCoordinator(t *testing.T) {
375380
"--log.output=+",
376381
"--server.authentication=true",
377382
"--server.endpoint=ssl://[::]:8529",
378-
"--server.jwt-secret=$(ARANGOD_JWT_SECRET)",
383+
"--server.jwt-secret-keyfile=" + jwtSecretFile,
379384
"--server.statistics=true",
380385
"--server.storage-engine=mmfiles",
381386
"--ssl.ecdh-curve=",

pkg/deployment/resources/pod_creator_dbserver_args_test.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// DISCLAIMER
33
//
4-
// Copyright 2020 ArangoDB GmbH, Cologne, Germany
4+
// Copyright 2020-2021 ArangoDB GmbH, Cologne, Germany
55
//
66
// Licensed under the Apache License, Version 2.0 (the "License");
77
// you may not use this file except in compliance with the License.
@@ -18,11 +18,13 @@
1818
// Copyright holder is ArangoDB GmbH, Cologne, Germany
1919
//
2020
// Author Ewout Prangsma
21+
// Author Tomasz Mielech
2122
//
2223

2324
package resources
2425

2526
import (
27+
"path/filepath"
2628
"testing"
2729

2830
"github.com/stretchr/testify/require"
@@ -34,10 +36,13 @@ import (
3436

3537
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
3638
"github.com/arangodb/kube-arangodb/pkg/util"
39+
"github.com/arangodb/kube-arangodb/pkg/util/constants"
40+
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
3741
)
3842

3943
// TestCreateArangodArgsDBServer tests createArangodArgs for dbserver.
4044
func TestCreateArangodArgsDBServer(t *testing.T) {
45+
jwtSecretFile := filepath.Join(k8sutil.ClusterJWTSecretVolumeMountDir, constants.SecretKeyToken)
4146
// Default deployment
4247
{
4348
apiObject := &api.ArangoDeployment{
@@ -85,7 +90,7 @@ func TestCreateArangodArgsDBServer(t *testing.T) {
8590
"--log.output=+",
8691
"--server.authentication=true",
8792
"--server.endpoint=ssl://[::]:8529",
88-
"--server.jwt-secret=$(ARANGOD_JWT_SECRET)",
93+
"--server.jwt-secret-keyfile=" + jwtSecretFile,
8994
"--server.statistics=true",
9095
"--server.storage-engine=rocksdb",
9196
"--ssl.ecdh-curve=",
@@ -143,7 +148,7 @@ func TestCreateArangodArgsDBServer(t *testing.T) {
143148
"--log.output=+",
144149
"--server.authentication=true",
145150
"--server.endpoint=ssl://[::]:8529",
146-
"--server.jwt-secret=$(ARANGOD_JWT_SECRET)",
151+
"--server.jwt-secret-keyfile=" + jwtSecretFile,
147152
"--server.statistics=true",
148153
"--server.storage-engine=rocksdb",
149154
"--ssl.ecdh-curve=",
@@ -202,7 +207,7 @@ func TestCreateArangodArgsDBServer(t *testing.T) {
202207
"--log.output=+",
203208
"--server.authentication=true",
204209
"--server.endpoint=ssl://[::]:8529",
205-
"--server.jwt-secret=$(ARANGOD_JWT_SECRET)",
210+
"--server.jwt-secret-keyfile=" + jwtSecretFile,
206211
"--server.statistics=true",
207212
"--server.storage-engine=rocksdb",
208213
"--ssl.ecdh-curve=",
@@ -262,7 +267,7 @@ func TestCreateArangodArgsDBServer(t *testing.T) {
262267
"--log.output=+",
263268
"--server.authentication=true",
264269
"--server.endpoint=tcp://[::]:8529",
265-
"--server.jwt-secret=$(ARANGOD_JWT_SECRET)",
270+
"--server.jwt-secret-keyfile=" + jwtSecretFile,
266271
"--server.statistics=true",
267272
"--server.storage-engine=rocksdb",
268273
},
@@ -376,7 +381,7 @@ func TestCreateArangodArgsDBServer(t *testing.T) {
376381
"--log.output=+",
377382
"--server.authentication=true",
378383
"--server.endpoint=ssl://[::]:8529",
379-
"--server.jwt-secret=$(ARANGOD_JWT_SECRET)",
384+
"--server.jwt-secret-keyfile=" + jwtSecretFile,
380385
"--server.statistics=true",
381386
"--server.storage-engine=mmfiles",
382387
"--ssl.ecdh-curve=",

pkg/deployment/resources/pod_creator_single_args_test.go

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// DISCLAIMER
33
//
4-
// Copyright 2020 ArangoDB GmbH, Cologne, Germany
4+
// Copyright 2020-2021 ArangoDB GmbH, Cologne, Germany
55
//
66
// Licensed under the Apache License, Version 2.0 (the "License");
77
// you may not use this file except in compliance with the License.
@@ -18,11 +18,13 @@
1818
// Copyright holder is ArangoDB GmbH, Cologne, Germany
1919
//
2020
// Author Ewout Prangsma
21+
// Author Tomasz Mielech
2122
//
2223

2324
package resources
2425

2526
import (
27+
"path/filepath"
2628
"testing"
2729

2830
"github.com/stretchr/testify/require"
@@ -33,11 +35,14 @@ import (
3335

3436
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
3537
"github.com/arangodb/kube-arangodb/pkg/util"
38+
"github.com/arangodb/kube-arangodb/pkg/util/constants"
39+
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
3640
"github.com/stretchr/testify/assert"
3741
)
3842

3943
// TestCreateArangodArgsSingle tests createArangodArgs for single server.
4044
func TestCreateArangodArgsSingle(t *testing.T) {
45+
jwtSecretFile := filepath.Join(k8sutil.ClusterJWTSecretVolumeMountDir, constants.SecretKeyToken)
4146
// Default deployment
4247
{
4348
apiObject := &api.ArangoDeployment{
@@ -69,7 +74,7 @@ func TestCreateArangodArgsSingle(t *testing.T) {
6974
"--log.output=+",
7075
"--server.authentication=true",
7176
"--server.endpoint=ssl://[::]:8529",
72-
"--server.jwt-secret=$(ARANGOD_JWT_SECRET)",
77+
"--server.jwt-secret-keyfile=" + jwtSecretFile,
7378
"--server.statistics=true",
7479
"--server.storage-engine=rocksdb",
7580
"--ssl.ecdh-curve=",
@@ -111,7 +116,7 @@ func TestCreateArangodArgsSingle(t *testing.T) {
111116
"--log.output=+",
112117
"--server.authentication=true",
113118
"--server.endpoint=ssl://[::]:8529",
114-
"--server.jwt-secret=$(ARANGOD_JWT_SECRET)",
119+
"--server.jwt-secret-keyfile=" + jwtSecretFile,
115120
"--server.statistics=true",
116121
"--server.storage-engine=rocksdb",
117122
"--ssl.ecdh-curve=",
@@ -155,7 +160,7 @@ func TestCreateArangodArgsSingle(t *testing.T) {
155160
"--log.output=+",
156161
"--server.authentication=true",
157162
"--server.endpoint=tcp://[::]:8529",
158-
"--server.jwt-secret=$(ARANGOD_JWT_SECRET)",
163+
"--server.jwt-secret-keyfile=" + jwtSecretFile,
159164
"--server.statistics=true",
160165
"--server.storage-engine=rocksdb",
161166
},
@@ -195,7 +200,7 @@ func TestCreateArangodArgsSingle(t *testing.T) {
195200
"--log.output=+",
196201
"--server.authentication=true",
197202
"--server.endpoint=ssl://[::]:8529",
198-
"--server.jwt-secret=$(ARANGOD_JWT_SECRET)",
203+
"--server.jwt-secret-keyfile=" + jwtSecretFile,
199204
"--server.statistics=true",
200205
"--server.storage-engine=mmfiles",
201206
"--ssl.ecdh-curve=",
@@ -278,7 +283,7 @@ func TestCreateArangodArgsSingle(t *testing.T) {
278283
"--log.output=+",
279284
"--server.authentication=true",
280285
"--server.endpoint=ssl://[::]:8529",
281-
"--server.jwt-secret=$(ARANGOD_JWT_SECRET)",
286+
"--server.jwt-secret-keyfile=" + jwtSecretFile,
282287
"--server.statistics=true",
283288
"--server.storage-engine=rocksdb",
284289
"--ssl.ecdh-curve=",
@@ -338,7 +343,7 @@ func TestCreateArangodArgsSingle(t *testing.T) {
338343
"--replication.automatic-failover=true",
339344
"--server.authentication=true",
340345
"--server.endpoint=ssl://[::]:8529",
341-
"--server.jwt-secret=$(ARANGOD_JWT_SECRET)",
346+
"--server.jwt-secret-keyfile=" + jwtSecretFile,
342347
"--server.statistics=true",
343348
"--server.storage-engine=rocksdb",
344349
"--ssl.ecdh-curve=",

0 commit comments

Comments
 (0)