@@ -105,18 +105,6 @@ export DOMAIN_HOME=${DOMAIN_HOME:-/shared/domains/${DOMAIN_UID}}
105
105
106
106
export NODEMGR_HOME=${NODEMGR_HOME:-/ shared/ nodemanagers}
107
107
108
- # TBD As a test enhancement, the following env vars could solely be derived
109
- # from the introspect topology file output, and
110
- # so should only need to be specified when creating a new domain.
111
- #
112
- # E.g. we ideally shouldn't need to define them here, and should
113
- # only need to explicitly set them when 'CREATE_DOMAIN' is set to true.
114
- # Plus the introspection parsing step in this test should parse
115
- # the topology file and use the parse results to export the needed values
116
- # for the subsequent admin and managed server pod launches, or if
117
- # the macros are already set, the test should verify the topology file
118
- # values match the values in those macros.
119
-
120
108
export ADMIN_NAME=${ADMIN_NAME:- " admin-server" }
121
109
export ADMIN_PORT=${ADMIN_PORT:- 7001}
122
110
export MANAGED_SERVER_NAME_BASE=${MANAGED_SERVER_NAME_BASE:- " managed-server" }
@@ -127,20 +115,17 @@ export DOMAIN_NAME=${DOMAIN_NAME:-"base_domain"}
127
115
# Set extra env vars needed when CREATE_DOMAIN == true
128
116
#
129
117
130
- if [ " $CREATE_DOMAIN " = " true" ]; then
131
-
132
- publicip=" ` kubectl cluster-info | grep KubeDNS | sed ' s;.*https://\(.*\):.*;\1;' ` "
133
- publicdns=" ` nslookup $publicip | grep ' name =' | sed ' s/.*name = \(.*\)./\1/' ` "
118
+ # publicip="`kubectl cluster-info | grep KubeDNS | sed 's;.*//\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\):.*;\1;'`"
119
+ # export TEST_HOST="`nslookup $publicip | grep 'name =' | sed 's/.*name = \(.*\)./\1/'`"
120
+ export TEST_HOST=" mycustompublicaddress"
134
121
135
- export CLUSTER_NAME=" ${CLUSTER_NAME:- mycluster} "
136
- export MANAGED_SERVER_PORT=${MANAGED_SERVER_PORT:- 8001}
137
- export CONFIGURED_MANAGED_SERVER_COUNT=${CONFIGURED_MANAGED_SERVER_COUNT:- 2}
138
- export CLUSTER_TYPE=" ${CLUSTER_TYPE:- DYNAMIC} "
139
- export T3_CHANNEL_PORT=${T3_CHANNEL_PORT:- 30012}
140
- export T3_PUBLIC_ADDRESS=${T3_PUBLIC_ADDRESS:- ${publicdns} }
141
- export PRODUCTION_MODE_ENABLED=${PRODUCTION_MODE_ENABLED:- true}
142
-
143
- fi
122
+ export CLUSTER_NAME=" ${CLUSTER_NAME:- mycluster} "
123
+ export MANAGED_SERVER_PORT=${MANAGED_SERVER_PORT:- 8001}
124
+ export CONFIGURED_MANAGED_SERVER_COUNT=${CONFIGURED_MANAGED_SERVER_COUNT:- 2}
125
+ export CLUSTER_TYPE=" ${CLUSTER_TYPE:- DYNAMIC} "
126
+ export T3_CHANNEL_PORT=${T3_CHANNEL_PORT:- 30012}
127
+ export T3_PUBLIC_ADDRESS=${T3_PUBLIC_ADDRESS:- }
128
+ export PRODUCTION_MODE_ENABLED=${PRODUCTION_MODE_ENABLED:- true}
144
129
145
130
# ############################################################################
146
131
#
155
140
# Location for this test to put its temporary files
156
141
test_home=/tmp/introspect
157
142
158
- function cleanup () {
143
+ function cleanupMajor () {
159
144
trace " Info: Cleaning files and k8s artifacts from previous run."
160
-
145
+
161
146
# first, let's delete the test's local tmp files for rm -fr
162
147
#
163
148
# CAUTION: We deliberately hard code the path here instead of using
@@ -188,6 +173,22 @@ function cleanup() {
188
173
fi
189
174
}
190
175
176
+ function cleanupMinor() {
177
+ trace " Info: RERUN_INTROSPECT_ONLY==true, skipping cleanup.sh and domain home setup, and only deleting wl pods + introspector job."
178
+
179
+ kubectl -n $NAMESPACE delete pod ${DOMAIN_UID} -${ADMIN_NAME} > /dev/null 2>&1
180
+ kubectl -n $NAMESPACE delete pod ${DOMAIN_UID} -${MANAGED_SERVER_NAME_BASE} 1 > /dev/null 2>&1
181
+ kubectl -n $NAMESPACE delete job ${DOMAIN_UID} -introspect-domain-job > /dev/null 2>&1
182
+ rm -fr ${test_home} /jobfiles
183
+ tracen " Info: Waiting for wl pods to completely go away before continuing."
184
+ while [ 1 -eq 1 ]; do
185
+ echo -n " ."
186
+ [ " ` kubectl -n ${NAMESPACE} get pods | grep ' ${DOMAIN_UID}.*server' ` " = " " ] && break
187
+ sleep 1
188
+ done
189
+ echo
190
+ }
191
+
191
192
# ############################################################################
192
193
#
193
194
# Helper function for running a job
@@ -301,7 +302,8 @@ function toDNS1123Legal {
301
302
# ############################################################################
302
303
#
303
304
# Deploy domain cm
304
- # - contains introspect, nm, start server scripts, etc.
305
+ # - this emulates what the operator pod would do
306
+ # - contains the operator's introspect, nm, start server scripts, etc.
305
307
# - mounted by create domain job, introspect job, and wl pods
306
308
#
307
309
@@ -347,16 +349,29 @@ function deployTestScriptConfigMap() {
347
349
348
350
# ############################################################################
349
351
#
350
- # Deploy custom override cm
351
- #
352
+ # Deploy custom override cm, just like a customer would
352
353
#
353
354
355
+
354
356
function deployCustomOverridesConfigMap() {
355
357
local cmdir=" ${test_home} /customOverrides"
356
358
local cmname=" ${DOMAIN_UID} -mycustom-overrides-cm"
359
+
360
+ trace " Info: Setting up custom overrides map '$cmname ' using directory '$cmdir '."
361
+
357
362
mkdir -p $cmdir
358
- cp ${SCRIPTPATH} /jdbc-testDS.xml $cmdir || exit 1
359
- cp ${SCRIPTPATH} /version.txt $cmdir || exit 1
363
+ rm -f $cmdir /* .xml
364
+ rm -f $cmdir /* .txt
365
+ local bfilname dfilname filname
366
+ for filname in override--* .xmlt override--* .txtt; do
367
+ bfilname=" ` basename $filname ` "
368
+ bfilname=" ${bfilname/ override--/ } "
369
+ bfilname=" ${bfilname/ xmlt/ xml} "
370
+ bfilname=" ${bfilname/ txtt/ txt} "
371
+ # echo $filname "+" $bfilname "+" ${cmdir}/${bfilname}
372
+ # cp ${filname} ${cmdir}/${bfilname} || exit 1
373
+ ${SCRIPTPATH} /util_subst.sh -g ${filname} ${cmdir} /${bfilname} || exit 1
374
+ done
360
375
361
376
kubectl -n $NAMESPACE delete cm $cmname \
362
377
--ignore-not-found \
@@ -365,6 +380,7 @@ function deployCustomOverridesConfigMap() {
365
380
createConfigMapFromDir $cmname $cmdir || exit 1
366
381
}
367
382
383
+
368
384
# ############################################################################
369
385
#
370
386
# Create base directory for PV (uses a job)
@@ -432,6 +448,7 @@ function deployCreateDomainJob() {
432
448
# ############################################################################
433
449
#
434
450
# Run introspection job, parse its output to files, and put files in a cm
451
+ # - this emulates what the operator pod would do prior to start wl-pods
435
452
#
436
453
437
454
function deployIntrospectJob() {
@@ -466,8 +483,9 @@ function deployIntrospectJob() {
466
483
467
484
# ############################################################################
468
485
#
469
- # Launch admin pod and wait up to 180 seconds for it to succeed, then launch
470
- # a managed server pod.
486
+ # Launch pod and wait up to 180 seconds for it to succeed, also launch
487
+ # services.
488
+ # - this emulates what the operator pod would do after running the introspect job
471
489
#
472
490
473
491
function deployPod() {
@@ -490,7 +508,6 @@ function deployPod() {
490
508
491
509
(
492
510
export SERVER_NAME=${server_name}
493
- # TBD SERVER_NAME, ADMIN_PORT, MANAGED_SERVER_PORT should be derived from introspect results
494
511
export SERVICE_NAME=` toDNS1123Legal ${DOMAIN_UID} -${server_name} `
495
512
export AS_SERVICE_NAME=` toDNS1123Legal ${DOMAIN_UID} -${ADMIN_NAME} `
496
513
if [ " ${SERVER_NAME} " = " ${ADMIN_NAME} " ]; then
@@ -521,7 +538,7 @@ function deployPod() {
521
538
fi
522
539
echo -n " ."
523
540
sleep 1
524
- status=` kubectl get pods -n $NAMESPACE 2>&1 | egrep $pod_name | awk ' {print $2}' `
541
+ status=` kubectl -n $NAMESPACE get pods -n $NAMESPACE 2>&1 | egrep $pod_name | awk ' {print $2}' `
525
542
done
526
543
echo " ($(( SECONDS - startsecs)) seconds)"
527
544
}
@@ -568,6 +585,58 @@ function deploySinglePodService() {
568
585
done
569
586
}
570
587
588
+
589
+ # ############################################################################
590
+ #
591
+ # Check if automatic overrides and custom overrides took effect on the admin pod
592
+ #
593
+
594
+ function checkOverrides() {
595
+
596
+ trace " Info: Checking admin server stdout to make sure situational config was loaded and there are no reported situational config errors."
597
+
598
+ # Check for exactly 3 occurances of Info.*.BEA.*situational lines -- one for each file we're overriding.
599
+ # the awk expression below gets the tail of the log, everything after the last occurance of 'Starting WebLogic...'
600
+
601
+ linecount=" ` kubectl -n ${NAMESPACE} logs ${DOMAIN_UID} -${ADMIN_NAME} | awk ' /.*Starting WebLogic server with command/ { buf = "" } { buf = buf "\n" $0 } END { print buf }' | grep -ci ' Info.*BEA.*situational' ` "
602
+ logstatus=0
603
+
604
+ if [ " $linecount " != " 3" ]; then
605
+ trace " Error: The latest boot in 'kubectl -n ${NAMESPACE} logs ${DOMAIN_UID} -${ADMIN_NAME} ' does not contain exactly 3 lines that match ' grep 'Info.*BEA.*situational' ', this probably means that it's reporting situational config problems."
606
+ logstatus=1
607
+ fi
608
+
609
+ #
610
+ # Call on-line WLST on the admin-server to determine if overrides are
611
+ # taking effect in the admin tree
612
+ #
613
+
614
+ trace " Info: Checking beans to see if sit-cfg took effect. Input file '$test_home /checkBeans.input', output file '$test_home /checkBeans.out'."
615
+
616
+ rm -f ${test_home} /checkBeans.input
617
+ ${SCRIPTPATH} /util_subst.sh -g checkBeans.inputt ${test_home} /checkBeans.input || exit 1
618
+ kubectl -n ${NAMESPACE} cp ${test_home} /checkBeans.input ${DOMAIN_UID} -${ADMIN_NAME} :/shared/checkBeans.input || exit 1
619
+ kubectl -n ${NAMESPACE} cp ${SCRIPTPATH} /checkBeans.py ${DOMAIN_UID} -${ADMIN_NAME} :/shared/checkBeans.py || exit 1
620
+ tracen " Info: Waiting for WLST checkBeans.py to complete."
621
+ printdots_start
622
+ # TBD weblogic/welcome1 should be deduced via a base64 of the admin secret
623
+ kubectl exec -it ${DOMAIN_UID} -${ADMIN_NAME} \
624
+ wlst.sh /shared/checkBeans.py \
625
+ weblogic welcome1 t3://${DOMAIN_UID} -${ADMIN_NAME} :${ADMIN_PORT} \
626
+ /shared/checkBeans.input \
627
+ > $test_home /checkBeans.out 2>&1
628
+ status=$?
629
+ printdots_end
630
+ if [ $status -ne 0 ]; then
631
+ trace " Error: The checkBeans verification failed, see '$test_home /checkBeans.out'."
632
+ fi
633
+
634
+ if [ $status -ne 0 ] || [ $logstatus -ne 0 ]; then
635
+ exit 1
636
+ fi
637
+ }
638
+
639
+
571
640
# ############################################################################
572
641
#
573
642
# Main
@@ -576,58 +645,52 @@ function deploySinglePodService() {
576
645
# PVCOMMENT is set, or if CREATE_DOMAIN is set to false.
577
646
#
578
647
579
- cleanup
648
+ #
649
+ # TBD ADMIN_NAME, ADMIN_PORT, and MANAGED_SERVER_NAME_BASE, etc env vars
650
+ # should be checked to see if topology file the introspector generated
651
+ # matches
652
+ #
580
653
581
- deployDomainConfigMap
654
+ if [ ! " $RERUN_INTROSPECT_ONLY " = " true " ] ; then
582
655
583
- deployTestScriptConfigMap
656
+ cleanupMajor
584
657
585
- deployCustomOverridesConfigMap
658
+ deployDomainConfigMap
659
+ deployTestScriptConfigMap
660
+ deployCustomOverridesConfigMap
661
+ createTestRootPVDir
662
+ deployWebLogic_PV_PVC_and_Secret
663
+ deployCreateDomainJob
664
+ deployIntrospectJob
665
+ deployPod ${ADMIN_NAME?}
666
+ deploySinglePodService ${ADMIN_NAME?} ${ADMIN_PORT?} 30701
667
+ deployPod ${MANAGED_SERVER_NAME_BASE?} 1
668
+ deploySinglePodService ${MANAGED_SERVER_NAME_BASE?} 1 ${MANAGED_SERVER_PORT?} 30801
586
669
587
- createTestRootPVDir
670
+ else
588
671
589
- deployWebLogic_PV_PVC_and_Secret
672
+ # This path assumes we've already run the test succesfully once, it re-uses
673
+ # the existing domain-home/pv/pvc/secret/etc, deletes wl pods, deletes introspect job, then
674
+ # redeploys the custom overrides, reruns the introspect job, and restarts the admin server pod.
590
675
591
- deployCreateDomainJob
676
+ cleanupMinor
592
677
593
- deployIntrospectJob
678
+ deployCustomOverridesConfigMap
679
+ deployIntrospectJob
680
+ deployPod ${ADMIN_NAME?}
681
+
682
+ fi
594
683
595
684
#
596
- # TBD ADMIN_NAME, 7001, and MANAGED_SERVER_NAME_BASE
597
- # below should all be derived from introspect
598
- # topology file
685
+ # Check admin-server pod log and also Call on-line WLST to check
686
+ # if automatic and custom overrides are taking effect in the bean
687
+ # tree.
599
688
#
600
689
601
- deployPod ${ADMIN_NAME?}
602
-
603
- deploySinglePodService ${ADMIN_NAME?} ${ADMIN_PORT?} 30701
604
-
605
- deployPod ${MANAGED_SERVER_NAME_BASE?} 1
606
-
607
- deploySinglePodService ${MANAGED_SERVER_NAME_BASE?} 1 ${MANAGED_SERVER_PORT?} 30801
690
+ checkOverrides
608
691
609
692
#
610
693
# TBD potentially add additional checks to verify wl pods are healthy
611
694
#
612
695
613
- # TBD 1 weblogic/welcome1 should be deduced via a base64 of the admin secret
614
- # TBD 2 generate checkBeans.input instead of using a hard coded file, add more beans to check, and check mgd servers too
615
-
616
- trace " Info: Checking beans to see if sit-cfg took effect. Input file 'checkBeans.input', output file '$test_home /checkBeans.out'."
617
- kubectl cp checkBeans.input domain1-admin-server:/shared/checkBeans.input || exit 1
618
- kubectl cp checkBeans.py domain1-admin-server:/shared/checkBeans.py || exit 1
619
- tracen " Info: Waiting for WLST checkBeans.py to complete."
620
- printdots_start
621
- kubectl exec -it domain1-admin-server \
622
- wlst.sh /shared/checkBeans.py \
623
- weblogic welcome1 t3://domain1-admin-server:7001 \
624
- /shared/checkBeans.input \
625
- > $test_home /checkBeans.out 2>&1
626
- status=$?
627
- printdots_end
628
- if [ $status -ne 0 ]; then
629
- trace " Error: checkBeans failed, see '$test_home /checkBeans.out'."
630
- exit 1
631
- fi
632
-
633
- trace " Info: success!"
696
+ trace " Info: Success!"
0 commit comments