Skip to content

Commit e815ac5

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

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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)

src/integration-tests/introspector/introspectTest.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff 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

767798
checkOverrides
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+
769805
trace "Info: Success!"

0 commit comments

Comments
 (0)