File tree Expand file tree Collapse file tree 2 files changed +74
-0
lines changed
src/integration-tests/introspector Expand file tree Collapse file tree 2 files changed +74
-0
lines changed Original file line number Diff line number Diff line change 1+ # Copyright 2018, 2019, Oracle Corporation and/or its affiliates. All rights reserved.
2+ # Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.a
3+
4+ #
5+ # purpose:
6+ #
7+ # invoke on-line WLST to check if a datasource is working
8+ #
9+ # assumes the admin user/pass was encoded to a userConfig/userKey by the
10+ # introspector these files have been mounted to /weblogic-operator/introspector
11+ #
12+ # usage:
13+ # wlst.sh checkDataSource.py url server-name data-source-name
14+ #
15+ # sample usage:
16+ # wlst.sh checkDataSource.py t3://domain1-admin-server:7001 admin-server mysqlDS
17+ #
18+
19+ import sys
20+
21+ url = sys .argv [1 ]
22+ server_name = sys .argv [2 ]
23+ data_source_name = sys .argv [3 ]
24+
25+ connect (userConfigFile = '/weblogic-operator/introspector/userConfigNodeManager.secure' ,userKeyFile = '/tmp/userKeyNodeManager.secure.bin' ,url = url )
26+
27+ serverRuntime ()
28+
29+ cd ('/JDBCServiceRuntime/' + server_name + '/JDBCDataSourceRuntimeMBeans/' + data_source_name )
30+
31+ ret = cmo .testPool ()
32+
33+ if ret is None :
34+ print 'ok'
35+ exit (exitcode = 0 )
36+ else :
37+ print 'error: ' + ret
38+ exit (exitcode = 1 )
Original file line number Diff line number Diff line change @@ -711,6 +711,37 @@ function checkOverrides() {
711711 fi
712712}
713713
714+ # ############################################################################
715+ #
716+ # Check if datasource is working
717+ #
718+
719+ function checkDataSource() {
720+
721+ local pod_name=${1?}
722+ local admin_url=${2?}
723+ local wl_server_name=${3?}
724+ local data_source_name=${4?}
725+ local script_file=checkDataSource.py
726+ local out_file=$test_home /checkDataSource-${pod_name} -${data_source_name} .out
727+
728+ local script_cmd=" wlst.sh /shared/${script_file} ${admin_url} ${wl_server_name} ${data_source_name} "
729+
730+ trace " Info: Checking datasource via '$script_cmd ' on pod '$pod_name '."
731+
732+ kubectl -n ${NAMESPACE} cp ${SCRIPTPATH} /${script_file} ${pod_name} :/shared/${script_file} || exit 1
733+
734+ tracen " Info: Waiting for script to complete"
735+ printdots_start
736+ kubectl exec -it ${pod_name} ${script_cmd} > ${out_file} 2>&1
737+ status=$?
738+ printdots_end
739+ if [ $status -ne 0 ]; then
740+ trace " Error: The '$script_cmd ' failed, see '$out_file '."
741+ exit 1
742+ fi
743+ }
744+
714745
715746# ############################################################################
716747#
@@ -766,4 +797,9 @@ waitForPod ${DOMAIN_UID}-${MANAGED_SERVER_NAME_BASE?}1
766797
767798checkOverrides
768799
800+ # Check DS to see if it can contact the DB. This will only pass if the
801+ # overrides actually took effect:
802+
803+ checkDataSource ${DOMAIN_UID} -${ADMIN_NAME?} t3://${DOMAIN_UID} -${ADMIN_NAME} :${ADMIN_PORT} ${ADMIN_NAME?} mysqlDS
804+
769805trace " Info: Success!"
You can’t perform that action at this time.
0 commit comments