Skip to content

Commit db83adb

Browse files
authored
Merge pull request #908 from oracle/int-test-instrumentation
Add more debugging output to integration tests.
2 parents a18e70f + c94a417 commit db83adb

File tree

3 files changed

+44
-9
lines changed

3 files changed

+44
-9
lines changed

integration-tests/src/test/java/oracle/kubernetes/operator/utils/Domain.java

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -993,14 +993,20 @@ private void callShellScriptByExecToPod(
993993
.append("'");
994994
logger.info("Command to call kubectl sh file " + cmdKubectlSh);
995995
ExecResult result = ExecCommand.exec(cmdKubectlSh.toString());
996-
if (result.exitValue() != 0) {
997-
throw new RuntimeException(
998-
"FAILURE: command " + cmdKubectlSh + " failed, returned " + result.stderr());
999-
}
1000-
String output = result.stdout().trim();
1001-
if (!output.contains("Deployment State : completed")) {
1002-
throw new RuntimeException("Failure: webapp deployment failed." + output);
1003-
}
996+
String resultStr =
997+
"Command= '"
998+
+ cmdKubectlSh
999+
+ "'"
1000+
+ ", exitValue="
1001+
+ result.exitValue()
1002+
+ ", stdout='"
1003+
+ result.stdout()
1004+
+ "'"
1005+
+ ", stderr='"
1006+
+ result.stderr()
1007+
+ "'";
1008+
if (result.exitValue() != 0 || !resultStr.contains("Deployment State : completed"))
1009+
throw new RuntimeException("FAILURE: webapp deploy failed - " + resultStr);
10041010
}
10051011

10061012
private void callWebAppAndWaitTillReady(String curlCmd) throws Exception {

integration-tests/src/test/resources/statedump.sh

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function state_dump {
3939
kubectl get all,crd,cm,pv,pvc,ns,roles,rolebindings,clusterroles,clusterrolebindings,secrets --show-labels=true --all-namespaces=true > ${DUMP_DIR}/kgetmany.out
4040
kubectl get domains --show-labels=true --all-namespaces=true > ${DUMP_DIR}/kgetdomains.out
4141

42-
# Get all pod logs and redirect/copy to files
42+
# Get all pod logs/describes and redirect/copy to files
4343

4444
set +x
4545
local namespaces="`kubectl get namespaces | egrep -v -e "(STATUS|kube)" | awk '{ print $1 }'`"
@@ -60,6 +60,32 @@ function state_dump {
6060
done
6161
done
6262

63+
# Get various k8s resource describes and redirect/copy to files
64+
65+
set +x
66+
local ktype
67+
local kobj
68+
local fname
69+
for namespace in $namespaces; do
70+
for ktype in pod job deploy rs service pvc ingress cm secret domain; do
71+
for kobj in `kubectl get $ktype -n $namespace -o=jsonpath='{range .items[*]}{" "}{.metadata.name}{end}'`; do
72+
fname="${DUMP_DIR}/kubectl.describe.$ktype.$kobj.ns-$namespace"
73+
echo "Generating $fname"
74+
kubectl describe $ktype $kobj -n $namespace > $fname
75+
done
76+
done
77+
done
78+
79+
# treat pv differently as a pv is not namespaced:
80+
for ktype in pv; do
81+
for kobj in `kubectl get $ktype -o=jsonpath='{range .items[*]}{" "}{.metadata.name}{end}'`; do
82+
fname="${DUMP_DIR}/kubectl.describe.$ktype.$kobj"
83+
echo "Generating $fname"
84+
kubectl describe $ktype $kobj > $fname
85+
done
86+
done
87+
set -x
88+
6389
# use a job to archive PV, /scratch mounts to PV_ROOT in the K8S cluster
6490
echo "Archiving pv directory using a kubernetes job. Look for it on k8s cluster in $PV_ROOT/acceptance_test_pv_archive"
6591
local outfile=${DUMP_DIR}/archive_pv_job.out

wercker.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ integration-test-java:
170170
echo "Integration test suite running for test image: $IMAGE_NAME_OPERATOR:$IMAGE_TAG_OPERATOR"
171171
echo "WebLogic version is: $IMAGE_NAME_WEBLOGIC:$IMAGE_TAG_WEBLOGIC"
172172
173+
# Echo the image's WL version - we don't care if this fails...
174+
$WERCKER_SOURCE_DIR/src/integration-tests/introspector/util_krun.sh -t 120 -i $IMAGE_NAME_WEBLOGIC:$IMAGE_TAG_WEBLOGIC -s $IMAGE_PULL_SECRET_WEBLOGIC -c 'source /u01/oracle/wlserver/server/bin/setWLSEnv.sh && java weblogic.version'
175+
173176
- script:
174177
name: Install pre-reqs
175178
code: |

0 commit comments

Comments
 (0)