Skip to content

Commit c05256b

Browse files
committed
Add tests for most of the create domain input parameter validation, change the name of the vars to pass the script names to the internal scripts so they don't collide w/ input param names, add a few missing create domain input paramter validations that the tests found
1 parent a0cd140 commit c05256b

File tree

7 files changed

+473
-11
lines changed

7 files changed

+473
-11
lines changed

kubernetes/create-weblogic-domain.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ internalDir="${scriptDir}/internal"
2323
# kubernetes.
2424

2525
# pass the name of this script to the internal create script
26-
createDomainScript="${script}"
26+
createScript="${script}"
2727

2828
# try to execute kubectl to see whether kubectl is available
2929
function validateKubectlAvailable {

kubernetes/create-weblogic-operator.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ internalDir="${scriptDir}/internal"
1111
# keytool, openssl, kubectl and kubernetes.
1212

1313
# pass the name of this script to the internal create script
14-
createOperatorScript="${script}"
14+
createScript="${script}"
1515

1616
# pass the location of the default operator inputs yaml file to the internal create script
1717
defaultOperatorInputsFile="${scriptDir}/create-weblogic-operator-inputs.yaml"

kubernetes/internal/create-weblogic-domain.sh

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
# - a unit testing script that only the tests call. it implements the abstracted behavior by mocking it out
2828
#
2929
# The caller of this script must define:
30-
# createDomainScript shell variable that has the full pathname of the script calling this script
30+
# createScript shell variable that has the full pathname of the script calling this script
3131
# validateKubectlAvailable shell function that validates whether kubectl is available
3232
# validateThatSecretExists shell function that validates whether a secret has been registered with kubernetes
3333
#
@@ -45,7 +45,7 @@ scriptDir="$( cd "$( dirname "${script}" )" && pwd )"
4545
source ${scriptDir}/utility.sh
4646

4747
function usage {
48-
echo usage: ${createDomainScript} -o dir -i file [-g] [-h]
48+
echo usage: ${createScript} -o dir -i file [-g] [-h]
4949
echo " -o Ouput directory for the generated yaml files, must be specified."
5050
echo " -i Parameter input file, must be specified."
5151
echo " -g Only generate the files to create the domain, do not execute them"
@@ -110,6 +110,13 @@ function validateDomainUid {
110110
validateLowerCase "domainUid" ${domainUid}
111111
}
112112

113+
#
114+
# Function to ensure the namespace is lowercase
115+
#
116+
function validateNamespace {
117+
validateLowerCase "namespace" ${namespace}
118+
}
119+
113120
#
114121
# Create an instance of clusterName to be used in cases where lowercase is required.
115122
#
@@ -208,7 +215,7 @@ function validateDomainSecret {
208215
#
209216
function validateImagePullSecretName {
210217
if [ ! -z ${imagePullSecretName} ]; then
211-
validateLowerCase "validateImagePullSecretName" ${imagePullSecretName}
218+
validateLowerCase imagePullSecretName ${imagePullSecretName}
212219
imagePullSecretPrefix=""
213220
if [ "${generateOnly}" = false ]; then
214221
validateImagePullSecret
@@ -333,7 +340,8 @@ function initialize {
333340
namespace \
334341
loadBalancer \
335342
javaOptions \
336-
startupControl
343+
startupControl \
344+
t3PublicAddress
337345

338346
validateIntegerInputParamsSpecified \
339347
adminPort \
@@ -351,6 +359,7 @@ function initialize {
351359
exposeAdminNodePort
352360

353361
validateDomainUid
362+
validateNamespace
354363
validateClusterName
355364
validateStorageClass
356365
validatePersistenVolumeName

kubernetes/internal/create-weblogic-operator.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# - a unit testing script that only the tests call. it implements the abstracted behavior by mocking it out
1919
#
2020
# The caller of this script must define:
21-
# createOperatorScript shell variable that has the full pathname of the script calling this script
21+
# createScript shell variable that has the full pathname of the script calling this script
2222
# defaultOperatorInputsFile shell variable that has the full pathname to kubernetes/create-weblogic-operator-inputs.yaml
2323
# genOprCertScript shell variable that has the full pathname of the script to use to generate certificates
2424
# validateKubectlAvailable shell function that validates whether kubectl is available
@@ -38,7 +38,7 @@ scriptDir="$( cd "$( dirname "${script}" )" && pwd )"
3838
source ${scriptDir}/utility.sh
3939

4040
function usage {
41-
echo usage: ${createOperatorScript} -o dir [-i file] [-g] [-h]
41+
echo usage: ${createScript} -o dir [-i file] [-g] [-h]
4242
echo " -o Ouput directory for the generated yaml files, must be specified."
4343
echo " -i Parameter input file, defaults to kubernetes/create-weblogic-operator-inputs.yaml"
4444
echo " -g Only generate the files to create the operator, do not execute them"
@@ -162,7 +162,7 @@ function initAndValidateOutputDir {
162162
#
163163
function validateImagePullSecretName {
164164
if [ ! -z ${imagePullSecretName} ]; then
165-
validateLowerCase "imagePullSecretName" ${imagePullSecretName}
165+
validateLowerCase imagePullSecretName ${imagePullSecretName}
166166
imagePullSecretPrefix=""
167167
validateImagePullSecret
168168
else

0 commit comments

Comments
 (0)