File tree Expand file tree Collapse file tree 8 files changed +85
-2
lines changed
operator/src/test/java/oracle/kubernetes/operator/create Expand file tree Collapse file tree 8 files changed +85
-2
lines changed Original file line number Diff line number Diff line change 1
1
# Copyright 2018, Oracle Corporation and/or its affiliates. All rights reserved.
2
2
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
3
3
4
+ # The version of this inputs file. Do not modify.
5
+ version : create-weblogic-domain-inputs/v1
6
+
4
7
# Port number for admin server
5
8
adminPort : 7001
6
9
Original file line number Diff line number Diff line change 1
1
# Copyright 2017, 2018 Oracle Corporation and/or its affiliates. All rights reserved.
2
2
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
3
3
4
+ # The version of this inputs file. Do not modify.
5
+ version : create-weblogic-operator-inputs/v1
6
+
4
7
# The name of the service account that the operator will use to
5
8
# make requests to the Kubernetes API server.
6
9
# The name must be lowercase
Original file line number Diff line number Diff line change @@ -107,6 +107,16 @@ function initAndValidateOutputDir {
107
107
domain-custom-resource.yaml
108
108
}
109
109
110
+ #
111
+ # Function to validate the version of the inputs file
112
+ #
113
+ function validateVersion {
114
+ local requiredVersion=' create-weblogic-domain-inputs/v1'
115
+ if [ " ${version} " != " ${requiredVersion} " ]; then
116
+ validationError " Invalid version: \" ${version} \" . Must be ${requiredVersion} ."
117
+ fi
118
+ }
119
+
110
120
#
111
121
# Function to ensure the domain uid is lowercase
112
122
#
@@ -376,7 +386,8 @@ function initialize {
376
386
weblogicCredentialsSecretName \
377
387
namespace \
378
388
javaOptions \
379
- t3PublicAddress
389
+ t3PublicAddress \
390
+ version
380
391
381
392
validateIntegerInputParamsSpecified \
382
393
adminPort \
@@ -393,6 +404,7 @@ function initialize {
393
404
exposeAdminT3Channel \
394
405
exposeAdminNodePort
395
406
407
+ validateVersion
396
408
validateDomainUid
397
409
validateNamespace
398
410
validateClusterName
Original file line number Diff line number Diff line change @@ -117,10 +117,12 @@ function initialize {
117
117
# Parse the common inputs file
118
118
parseCommonInputs
119
119
120
- validateInputParamsSpecified serviceAccount namespace targetNamespaces weblogicOperatorImage
120
+ validateInputParamsSpecified version serviceAccount namespace targetNamespaces weblogicOperatorImage
121
121
122
122
validateBooleanInputParamsSpecified elkIntegrationEnabled
123
123
124
+ validateVersion
125
+
124
126
validateServiceAccount
125
127
126
128
validateNamespace
@@ -203,6 +205,16 @@ function validateImagePullPolicy {
203
205
fi
204
206
}
205
207
208
+ #
209
+ # Function to validate the version of the inputs file
210
+ #
211
+ function validateVersion {
212
+ local requiredVersion=' create-weblogic-operator-inputs/v1'
213
+ if [ " ${version} " != " ${requiredVersion} " ]; then
214
+ validationError " Invalid version: \" ${version} \" . Must be ${requiredVersion} ."
215
+ fi
216
+ }
217
+
206
218
#
207
219
# Function to validate the service account is lowercase
208
220
#
Original file line number Diff line number Diff line change @@ -76,6 +76,7 @@ public class CreateDomainInputs {
76
76
private String loadBalancerVolumePath = "" ;
77
77
private String loadBalancerAppPrepath = "" ;
78
78
private String javaOptions = "" ;
79
+ private String version = "" ;
79
80
80
81
public static CreateDomainInputs newInputs () throws Exception {
81
82
return
@@ -534,6 +535,19 @@ public CreateDomainInputs javaOptions(String javaOptions) {
534
535
return this ;
535
536
}
536
537
538
+ public String getVersion () {
539
+ return version ;
540
+ }
541
+
542
+ public void setVersion (String version ) {
543
+ this .version = convertNullToEmptyString (version );
544
+ }
545
+
546
+ public CreateDomainInputs version (String version ) {
547
+ setVersion (version );
548
+ return this ;
549
+ }
550
+
537
551
private String convertNullToEmptyString (String val ) {
538
552
return Objects .toString (val , "" );
539
553
}
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ public class CreateDomainInputsValidationTest {
48
48
private static final String PARAM_LOAD_BALANCER_WEB_PORT = "loadBalancerWebPort" ;
49
49
private static final String PARAM_LOAD_BALANCER_DASHBOARD_PORT = "loadBalancerDashboardPort" ;
50
50
private static final String PARAM_JAVA_OPTIONS = "javaOptions" ;
51
+ private static final String PARAM_VERSION = "version" ;
51
52
52
53
@ Before
53
54
public void setup () throws Exception {
@@ -523,6 +524,21 @@ public void createDomain_with_missingJavaOptions_failsAndReturnsError() throws E
523
524
failsAndPrints (paramMissingError (PARAM_JAVA_OPTIONS )));
524
525
}
525
526
527
+ @ Test
528
+ public void createDomain_with_missingVersion_failsAndReturnsError () throws Exception {
529
+ assertThat (
530
+ execCreateDomain (newInputs ().version ("" )),
531
+ failsAndPrints (paramMissingError (PARAM_VERSION )));
532
+ }
533
+
534
+ @ Test
535
+ public void createDomainwith_invalidVersion_failsAndReturnsError () throws Exception {
536
+ String val = "no-such-version" ;
537
+ assertThat (
538
+ execCreateDomain (newInputs ().version (val )),
539
+ failsAndPrints (invalidEnumParamValueError (PARAM_VERSION , val )));
540
+ }
541
+
526
542
private void createDomain_with_validStartupControl_succeeds (String startupControl ) throws Exception {
527
543
createDomain_with_validInputs_succeeds (newInputs ().startupControl (startupControl ));
528
544
}
Original file line number Diff line number Diff line change @@ -148,6 +148,11 @@ private String internalSans() {
148
148
// Note: don't allow null strings since, if you use snakeyaml to write out the instance
149
149
// to a yaml file, the nulls are written out as "null". Use "" instead.
150
150
151
+ private String version = "" ;
152
+ public String getVersion () { return version ; }
153
+ public void setVersion (String val ) { version = convertNullToEmptyString (val ); }
154
+ public CreateOperatorInputs version (String val ) { setVersion (val ); return this ; }
155
+
151
156
private String serviceAccount = "" ;
152
157
public String getServiceAccount () { return serviceAccount ; }
153
158
public void setServiceAccount (String val ) { serviceAccount = convertNullToEmptyString (val ); }
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ public void tearDown() throws Exception {
33
33
}
34
34
}
35
35
36
+ private static final String PARAM_VERSION = "version" ;
36
37
private static final String PARAM_SERVICE_ACCOUNT = "serviceAccount" ;
37
38
private static final String PARAM_NAMESPACE = "namespace" ;
38
39
private static final String PARAM_TARGET_NAMESPACES = "targetNamespaces" ;
@@ -50,6 +51,23 @@ public void tearDown() throws Exception {
50
51
private static final String PARAM_JAVA_LOGGING_LEVEL = "javaLoggingLevel" ;
51
52
private static final String PARAM_ELK_INTEGRATION_ENABLED = "elkIntegrationEnabled" ;
52
53
54
+ private static final String VERSION_V1 = "create-weblogic-operator-inputs/v1" ;
55
+
56
+ @ Test
57
+ public void createOperator_with_missingVersion_failsAndReturnsError () throws Exception {
58
+ assertThat (
59
+ execCreateOperator (newInputs ().version ("" )),
60
+ failsAndPrints (paramMissingError (PARAM_VERSION )));
61
+ }
62
+
63
+ @ Test
64
+ public void createOperator_with_invalidVersion_failsAndReturnsError () throws Exception {
65
+ String val = "no-such-version" ;
66
+ assertThat (
67
+ execCreateOperator (newInputs ().version (val )),
68
+ failsAndPrints (invalidEnumParamValueError (PARAM_VERSION , val )));
69
+ }
70
+
53
71
@ Test
54
72
public void createOperator_with_missingServiceAccount_failsAndReturnsError () throws Exception {
55
73
assertThat (
You can’t perform that action at this time.
0 commit comments