File tree Expand file tree Collapse file tree 7 files changed +37
-24
lines changed Expand file tree Collapse file tree 7 files changed +37
-24
lines changed Original file line number Diff line number Diff line change 7
7
# INPUT ENVIRONMENT VARIABLES
8
8
TIMEOUT? =168h
9
9
10
+ CLUSTER_NAME? =
10
11
NAMESPACE? =
11
- PREFIX? =
12
12
CONTEXT? =
13
13
FDB_VERSION? =7.1.53
14
14
# This will be the version used for upgrade tests.
@@ -111,7 +111,6 @@ nightly-tests: run
111
111
--ginkgo.timeout=$(TIMEOUT ) \
112
112
--timeout=$(TIMEOUT ) \
113
113
--namespace=" $( NAMESPACE) " \
114
- --prefix=" $( PREFIX) " \
115
114
--context=" $( CONTEXT) " \
116
115
--fdb-image=" $( FDB_IMAGE) " \
117
116
--sidecar-image=" $( SIDECAR_IMAGE) " \
@@ -129,4 +128,5 @@ nightly-tests: run
129
128
--feature-dns=$(FEATURE_DNS ) \
130
129
--cloud-provider=$(CLOUD_PROVIDER ) \
131
130
--dump-operator-state=$(DUMP_OPERATOR_STATE ) \
131
+ --cluster-name=$(CLUSTER_NAME ) \
132
132
| grep -v ' constructing many client instances from the same exec auth config can cause performance problems during cert rotation' & > $(BASE_DIR ) /../logs/$< .log
Original file line number Diff line number Diff line change @@ -19,6 +19,17 @@ make -C e2e test_operator.run
19
19
20
20
Every test suite will create at least one namespace, HA cluster tests will create all the required namespaces.
21
21
22
+ ### Reusing an existing test cluster
23
+
24
+ A test cluster can be reused if wanted, e.g. for test cases that load a large amount of data into the cluster.
25
+ This requires to specify the ` CLUSTER_NAME ` and the ` NAMESPACE ` , if those values are not specified the test suite will use randomized values.
26
+ ** NOTE ** The limitation of this approach is that the test suite will not update the existing ` FoundationDBCluster ` in the creation step.
27
+ So if you're modifying the ` FoundationDBCluster ` spec, you have to recreate the cluster.
28
+
29
+ ``` bash
30
+ CLEANUP=false CLUSTER_NAME=dev-cluster-1 NAMESPACE=dev make -kj -C e2e run
31
+ ```
32
+
22
33
### StorageClass selection
23
34
24
35
The e2e tests assume that at least one ` StorageClass ` is present in the target Kubernetes cluster.
Original file line number Diff line number Diff line change @@ -125,7 +125,7 @@ func DefaultClusterConfig(debugSymbols bool) *ClusterConfig {
125
125
// SetDefaults will set all unset fields to the default values.
126
126
func (config * ClusterConfig ) SetDefaults (factory * Factory ) {
127
127
if config .Name == "" {
128
- config .Name = factory .getClusterPrefix ()
128
+ config .Name = factory .getClusterName ()
129
129
}
130
130
131
131
// Only create the namespace for non HA clusters, otherwise the namespaces will be created in a different way.
Original file line number Diff line number Diff line change @@ -254,12 +254,12 @@ func (factory *Factory) getContainerOverrides(
254
254
return mainOverrides , sidecarOverrides
255
255
}
256
256
257
- func (factory * Factory ) getClusterPrefix () string {
258
- prefix := factory .options .prefix
259
- if prefix == "" {
257
+ func (factory * Factory ) getClusterName () string {
258
+ if factory .options .clusterName == "" {
260
259
return fmt .Sprintf ("fdb-cluster-%s" , RandStringRunes (8 ))
261
260
}
262
- return prefix
261
+
262
+ return factory .options .clusterName
263
263
}
264
264
265
265
// GetDefaultStorageClass returns either the StorageClass provided by the command line or fetches the StorageClass passed on
Original file line number Diff line number Diff line change @@ -151,7 +151,7 @@ func (factory *Factory) ensureHAFdbClusterExists(
151
151
options []ClusterOption ,
152
152
) (* HaFdbCluster , error ) {
153
153
fdb := & HaFdbCluster {}
154
- clusterPrefix := factory .getClusterPrefix ()
154
+ clusterPrefix := factory .getClusterName ()
155
155
156
156
databaseConfiguration := config .CreateDatabaseConfiguration ()
157
157
dcIDs := GetDcIDsFromConfig (databaseConfiguration )
Original file line number Diff line number Diff line change @@ -33,7 +33,6 @@ import (
33
33
type FactoryOptions struct {
34
34
namespace string
35
35
chaosNamespace string
36
- prefix string
37
36
context string
38
37
fdbImage string // TODO (johscheuer): Make this optional if we use the default
39
38
sidecarImage string // TODO (johscheuer): Make this optional if we use the default
@@ -45,6 +44,7 @@ type FactoryOptions struct {
45
44
storageClass string
46
45
upgradeString string
47
46
cloudProvider string
47
+ clusterName string
48
48
enableChaosTests bool
49
49
enableDataLoading bool
50
50
cleanup bool
@@ -69,12 +69,6 @@ func (options *FactoryOptions) BindFlags(fs *flag.FlagSet) {
69
69
"" ,
70
70
"defines the chaos namespace to run experiments (will be created if missing)" ,
71
71
)
72
- fs .StringVar (
73
- & options .prefix ,
74
- "prefix" ,
75
- "" ,
76
- "defines the prefix of fdb cluster to run the test (will be created if missing)" ,
77
- )
78
72
fs .StringVar (
79
73
& options .context ,
80
74
"context" ,
@@ -183,6 +177,11 @@ func (options *FactoryOptions) BindFlags(fs *flag.FlagSet) {
183
177
true ,
184
178
"defines if the operator tests should print the state of the cluster and the according Pods for better debugging." ,
185
179
)
180
+ fs .StringVar (& options .clusterName ,
181
+ "cluster-name" ,
182
+ "" ,
183
+ "if defined, the test suite will create a cluster with the specified name or update the setting of an existing cluster." +
184
+ "For multi-region clusters, this will define the prefix for all clusters." )
186
185
}
187
186
188
187
func (options * FactoryOptions ) validateFlags () error {
Original file line number Diff line number Diff line change @@ -152,16 +152,19 @@ func (fdbCluster *FdbCluster) RunFdbCliCommandInOperatorWithoutRetry(
152
152
break
153
153
}
154
154
155
- var parsedStatus * fdbv1beta2.FoundationDBStatus
156
- parsedStatus , err = parseStatusOutput (stdout )
157
- // If we cannot parse the status we probably have an error or timeout
158
- if err != nil {
159
- continue
160
- }
155
+ // Only try to parse the content to json if the command was "status json".
156
+ if strings .Contains (command , "status json" ) {
157
+ var parsedStatus * fdbv1beta2.FoundationDBStatus
158
+ parsedStatus , err = parseStatusOutput (stdout )
159
+ // If we cannot parse the status we probably have an error or timeout
160
+ if err != nil {
161
+ continue
162
+ }
161
163
162
- // Quorum of coordinators are available, so we probably use the correct version
163
- if parsedStatus .Client .Coordinators .QuorumReachable {
164
- break
164
+ // Quorum of coordinators are available, so we probably use the correct version
165
+ if parsedStatus .Client .Coordinators .QuorumReachable {
166
+ break
167
+ }
165
168
}
166
169
}
167
170
You can’t perform that action at this time.
0 commit comments