Skip to content

Commit b8afbc2

Browse files
author
Tom Barnes
committed
Config overrides test update.
1 parent e815ac5 commit b8afbc2

File tree

11 files changed

+237
-198
lines changed

11 files changed

+237
-198
lines changed

src/integration-tests/introspector/README

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Internal Test Flow:
3333

3434
Cleanup files in /tmp/introspect
3535

36-
() Cleanup test k8s artifacts and (optionally) an old created domain.
36+
() Cleanup test k8s artifacts and any old created domain.
3737

3838
<operator-src>/src/integration-tests/bash/cleanup.sh
3939

@@ -42,21 +42,22 @@ Internal Test Flow:
4242
create-test-root-pv.yamlt, create-test-root-pvc.yamlt
4343
create-test-root.sh, create-test-root-job.yamlt
4444

45-
() Optionally deploy pv/pvc for use by introspector job, the optional domain create step, and wl pods. (If PV_COMMENT != "#").
45+
() Deploy pv/pvc for use by introspector job, the domain create step, and wl pods. (If PV_COMMENT != "#").
4646

4747
wl-pv.yamlt, wl-pvc.yamlt
4848

4949
() Deploy a secret for the admin credentials.
5050

5151
wl-secret.yamlt
5252

53-
() Optionally create a domain home. (If CREATE_DOMAIN == "true").
53+
() Create a domain home.
5454

55-
wl-job.yamlt, createDomain.sh, createDomain.pyt
55+
wl-create-domain-pod.yamlt, wl-create-domain-pod.sh, wl-create-domain-pod.pyt
5656

57-
() Run the introspector job.
57+
() Run the introspector job (as a direct pod instead of a job)
5858

59-
wl-job.yamlt
59+
wl-instrospect-pod.yamlt
60+
wl-instrospect-pod.sh
6061
<operator-src>/operator/src/main/resources/scripts/introspectDomain.sh
6162
<operator-src>/operator/src/main/resources/scripts/startNodeManager.sh
6263
<operator-src>/operator/src/main/resources/scripts/introspectDomain.py

src/integration-tests/introspector/checkBeans.inputt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
# Note that a customer/admin should never override a port, they must stay fixed
2626
/ServerTemplates/mycluster-template,ListenPort,8001,8001
2727

28-
/JDBCSystemResources/testDS/JDBCResource/testDS/JDBCDriverParams/testDS,Url,jdbc:oracle:thin:@myoriginalhostname:1521:myoriginalsid,jdbc:oracle:thin:@mynewhost:1521:mynewsid
28+
/JDBCSystemResources/testDS/JDBCResource/testDS/JDBCDriverParams/testDS,Url,jdbc:oracle:thin:@invalid-host:1521:invalid-sid,jdbc:oracle:thin:@mynewhost:1521:mynewsid
2929
/JDBCSystemResources/testDS/JDBCResource/testDS/JDBCDriverParams/testDS,PasswordEncrypted,*,!
30-
/JDBCSystemResources/testDS/JDBCResource/testDS/JDBCDriverParams/testDS/Properties/testDS/Properties/user,Value,scott,supersecret
30+
/JDBCSystemResources/testDS/JDBCResource/testDS/JDBCDriverParams/testDS/Properties/testDS/Properties/user,Value,invalid-user,supersecret
3131

32-
/JDBCSystemResources/mysqlDS/JDBCResource/mysqlDS/JDBCDriverParams/mysqlDS,Url,jdbc:mysql://invalid-url:3306/mysql,jdbc:mysql://${DOMAIN_UID}-mysql:3306/mysql
33-
/JDBCSystemResources/mysqlDS/JDBCResource/mysqlDS/JDBCDriverParams/mysqlDS/Properties/mysqlDS/Properties/user,Value,invalid-user,root
32+
/JDBCSystemResources/mysqlDS/JDBCResource/mysqlDS/JDBCDriverParams/mysqlDS,Url,jdbc:mysql://invalid-host:3306/mysql,jdbc:mysql://${DOMAIN_UID}-mysql:3306/mysql
3433
/JDBCSystemResources/mysqlDS/JDBCResource/mysqlDS/JDBCDriverParams/mysqlDS,PasswordEncrypted,*,!
34+
/JDBCSystemResources/mysqlDS/JDBCResource/mysqlDS/JDBCDriverParams/mysqlDS/Properties/mysqlDS/Properties/user,Value,invalid-user,root

src/integration-tests/introspector/createDomain.sh

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/integration-tests/introspector/introspectTest.sh

Lines changed: 58 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,11 @@
1111
# introspector is working correctly, and for quickly testing changes to
1212
# its overall flow.
1313
#
14-
# See the README in this directory for overall flow and usage.
15-
#
16-
# Notes:
14+
# The test calls the integration test 'cleanup.sh' when it starts, which
15+
# will delete all test resources and the domain_home that might
16+
# have been left over from a previous run.
1717
#
18-
# The test can optionally work with any arbitrary existing domain home, or
19-
# it can create a domain_home for you. See CREATE_DOMAIN in the implementation
20-
# below, (default true).
21-
#
22-
# The test calls the integration test 'cleanup.sh' when it starts. It
23-
# passes a special parameter to cleanup.sh to skip domain_home deletion if
24-
# the test's CREATE_DOMAIN parameter is set to false.
18+
# See the README in this directory for overall flow and usage.
2519
#
2620
# Internal design:
2721
#
@@ -62,31 +56,7 @@ export PV_ROOT=${PV_ROOT:-/scratch/$USER/wl_k8s_test_results}
6256

6357
#############################################################################
6458
#
65-
# Set CREATE_DOMAIN to false to use an existing domain instead
66-
# of creating a new one.
67-
# - If setting to true (the default), see "extra env var" section below
68-
# for additional related env vars.
69-
# - If setting to false, remember to also set PVCOMMENT if the
70-
# pre-existing domain is not in a PV.
71-
#
72-
73-
CREATE_DOMAIN=${CREATE_DOMAIN:-true}
74-
75-
#############################################################################
76-
#
77-
# Set PVCOMMENT to "#" to remove PV from wl-job/wl-pod yaml.
78-
# - Do this when the introspector job or wl-pod already has
79-
# the domain home burned into the image and so doesn't need
80-
# to mount a PV.
81-
# - Do not do this when CREATE_DOMAIN is true (create domain
82-
# depends on the PV).
83-
#
84-
85-
export PVCOMMENT=${PVCOMMENT:-""}
86-
87-
#############################################################################
88-
#
89-
# Set env vars for an existing domain and/or a to-be-created domain:
59+
# Set env vars for to-be-created domain:
9060
#
9161

9262
export WEBLOGIC_IMAGE_NAME=${WEBLOGIC_IMAGE_NAME:-store/oracle/weblogic}
@@ -111,11 +81,6 @@ export MANAGED_SERVER_NAME_BASE=${MANAGED_SERVER_NAME_BASE:-"managed-server"}
11181
export DOMAIN_NAME=${DOMAIN_NAME:-"base_domain"}
11282
export ADMINISTRATION_PORT=${ADMINISTRATION_PORT:-7099}
11383

114-
#############################################################################
115-
#
116-
# Set extra env vars needed when CREATE_DOMAIN == true
117-
#
118-
11984
#publicip="`kubectl cluster-info | grep KubeDNS | sed 's;.*//\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\):.*;\1;'`"
12085
#export TEST_HOST="`nslookup $publicip | grep 'name =' | sed 's/.*name = \(.*\)./\1/'`"
12186
export TEST_HOST="mycustompublicaddress"
@@ -159,12 +124,10 @@ function cleanupMajor() {
159124
#
160125
# 1 - delete all operator related k8s artifacts
161126
# 2 - delete contents of k8s weblogic domain PV/PVC
162-
# (if CREATE_DOMAIN has been set to "true")
163127

164128
tracen "Info: Waiting for cleanup.sh to complete."
165129
printdots_start
166130
FAST_DELETE="--grace-period=1 --timeout=1s" \
167-
DELETE_FILES=${CREATE_DOMAIN:-false} \
168131
${SOURCEPATH}/src/integration-tests/bash/cleanup.sh 2>&1 > \
169132
${test_home}/cleanup.out
170133
status=$?
@@ -341,14 +304,12 @@ function deployTestScriptConfigMap() {
341304
mkdir -p ${test_home}/test-scripts
342305

343306
cp ${SOURCEPATH}/operator/src/main/resources/scripts/traceUtils* ${test_home}/test-scripts || exit 1
344-
cp ${SCRIPTPATH}/createDomain.sh ${test_home}/test-scripts || exit 1
307+
cp ${SCRIPTPATH}/wl-create-domain-pod.sh ${test_home}/test-scripts || exit 1
345308
cp ${SCRIPTPATH}/createTestRoot.sh ${test_home}/test-scripts || exit 1
346-
cp ${SCRIPTPATH}/introspectDomainProxy.sh ${test_home}/test-scripts || exit 1
309+
cp ${SCRIPTPATH}/wl-introspect-pod.sh ${test_home}/test-scripts || exit 1
347310

348-
if [ "$CREATE_DOMAIN" = "true" ]; then
349-
rm -f ${test_home}/test-scripts/createDomain.py
350-
${SCRIPTPATH}/util_subst.sh -g createDomain.pyt ${test_home}/test-scripts/createDomain.py || exit 1
351-
fi
311+
rm -f ${test_home}/test-scripts/wl-create-domain-pod.py
312+
${SCRIPTPATH}/util_subst.sh -g wl-create-domain-pod.pyt ${test_home}/test-scripts/wl-create-domain-pod.py || exit 1
352313

353314
kubectl -n $NAMESPACE delete cm test-script-cm \
354315
--ignore-not-found \
@@ -395,13 +356,10 @@ function deployCustomOverridesConfigMap() {
395356
#############################################################################
396357
#
397358
# Create base directory for PV (uses a job)
398-
# (Skip if PVCOMMENT="#".)
399359
#
400360

401361
function createTestRootPVDir() {
402362

403-
[ "$PVCOMMENT" = "#" ] && return
404-
405363
trace "Info: Creating k8s cluster physical directory 'PV_ROOT/acceptance_test_pv/domain-${DOMAIN_UID}-storage'."
406364
trace "Info: PV_ROOT='$PV_ROOT'"
407365
trace "Info: Test k8s resources use this physical directory via a PV/PVC '/shared' logical directory."
@@ -425,14 +383,13 @@ function createTestRootPVDir() {
425383
#############################################################################
426384
#
427385
# Deploy WebLogic pv, pvc, & admin user/pass secret
428-
# (Skip pv/pvc if PVCOMMENT="#".)
429386
#
430387

431388
function deployWebLogic_PV_PVC_and_Secret() {
432389
trace "Info: Deploying WebLogic domain's pv, pvc, & secret."
433390

434-
[ "$PVCOMMENT" = "#" ] || deployYamlTemplate wl-pv.yamlt wl-pv.yaml
435-
[ "$PVCOMMENT" = "#" ] || deployYamlTemplate wl-pvc.yamlt wl-pvc.yaml
391+
deployYamlTemplate wl-pv.yamlt wl-pv.yaml
392+
deployYamlTemplate wl-pvc.yamlt wl-pvc.yaml
436393
deployYamlTemplate wl-secret.yamlt wl-secret.yaml
437394
}
438395

@@ -453,22 +410,56 @@ function deployMySQL() {
453410

454411
#############################################################################
455412
#
456-
# Run create domain job if CREATE_DOMAIN is true
413+
# Run create domain "JobPod" - This is a pod that acts somewhat like a job
457414
#
458415

459-
function deployCreateDomainJob() {
460-
[ ! "$CREATE_DOMAIN" = "true" ] && return 0
416+
function deployCreateDomainJobPod() {
417+
trace "Info: Run create domain pod."
418+
419+
local target_yaml=${test_home}/wl-create-domain-pod.yaml
420+
local pod_name=${DOMAIN_UID}-create-domain-pod
421+
422+
# delete anything left over from a previous invocation of this function, assume all pods
423+
# have already been cleaned up
424+
425+
rm -f ${target_yaml}
426+
427+
trace "Info: Deploying job pod '$pod_name' and waiting for it to be ready."
428+
429+
(
430+
export JOB_SCRIPT=/test-scripts/wl-create-domain-pod.sh
431+
${SCRIPTPATH}/util_subst.sh -g wl-create-domain-pod.yamlt ${target_yaml} || exit 1
432+
) || exit 1
433+
434+
kubectl create -f ${target_yaml} \
435+
2>&1 | tracePipe "Info: kubectl output: " || exit 1
461436

462-
trace "Info: Run create domain job."
437+
# Wait for pod to come up successfully
463438

464-
[ "$PVCOMMENT" = "#" ] \
465-
&& trace "Error: Cannot run create domain job, PV is disabled via PVCOMMENT." \
466-
&& exit 1
439+
waitForPod $pod_name
440+
441+
# TODO: We can eliminate the following code if we (1) have job pod script touch
442+
# a file upon completion, and (2) have job pod ready check look for this file
443+
444+
local startSecs=$SECONDS
445+
local maxsecs=30
446+
local exitString=""
447+
tracen "Info: Waiting up to $maxsecs seconds for pod '$pod_name' to run the wl-create-domain-pod.py script."
448+
printdots_start
449+
while [ $((SECONDS - startSecs)) -lt $maxsecs ] && [ "$exitString" = "" ]; do
450+
exitString="`kubectl -n $NAMESPACE logs $pod_name 2>&1 | grep CREATE_DOMAIN_EXIT`"
451+
sleep 1
452+
done
453+
printdots_end
454+
if [ "$exitString" = "" ]; then
455+
trace "Error: Timed out, see 'kubectl -n $NAMESPACE logs $pod_name'."
456+
exit 1
457+
fi
458+
if [ ! "$exitString" = "CREATE_DOMAIN_EXIT=0" ]; then
459+
trace "Error: Pod script failed, see 'kubectl -n $NAMESPACE logs $pod_name'."
460+
exit 1
461+
fi
467462

468-
runJob ${DOMAIN_UID}-create-domain-job \
469-
/test-scripts/createDomain.sh \
470-
wl-job.yamlt \
471-
wl-create-domain-job.yaml
472463
}
473464

474465
#############################################################################
@@ -484,7 +475,6 @@ function deployIntrospectJobPod() {
484475
local introspect_output_cm_name=${DOMAIN_UID}-weblogic-domain-introspect-cm
485476
local target_yaml=${test_home}/wl-introspect-pod.yaml
486477
local pod_name=${DOMAIN_UID}--introspect-domain-pod
487-
local job_name=$pod_name
488478

489479
trace "Info: Run introspection job, parse its output to files, and put files in configmap '$introspect_output_cm_name'."
490480

@@ -502,7 +492,7 @@ function deployIntrospectJobPod() {
502492
(
503493
export SERVER_NAME=introspect
504494
export JOB_NAME=${DOMAIN_UID}--introspect-domain-pod
505-
export JOB_SCRIPT=/test-scripts/introspectDomainProxy.sh
495+
export JOB_SCRIPT=/test-scripts/wl-introspect-pod.sh
506496
export SERVICE_NAME=`toDNS1123Legal ${DOMAIN_UID}-${server_name}`
507497
export AS_SERVICE_NAME=`toDNS1123Legal ${DOMAIN_UID}-${ADMIN_NAME}`
508498
if [ "${SERVER_NAME}" = "${ADMIN_NAME}" ]; then
@@ -747,9 +737,6 @@ function checkDataSource() {
747737
#
748738
# Main
749739
#
750-
# Some of the following calls will be a partial or complete no-op if
751-
# PVCOMMENT is set, or if CREATE_DOMAIN is set to false.
752-
#
753740

754741
if [ ! "$RERUN_INTROSPECT_ONLY" = "true" ]; then
755742
cleanupMajor
@@ -768,7 +755,7 @@ if [ ! "$RERUN_INTROSPECT_ONLY" = "true" ]; then
768755
createTestRootPVDir
769756
deployMySQL
770757
deployWebLogic_PV_PVC_and_Secret
771-
deployCreateDomainJob
758+
deployCreateDomainJobPod
772759
fi
773760

774761
kubectl -n $NAMESPACE delete secret my-secret > /dev/null 2>&1

0 commit comments

Comments
 (0)