Skip to content

Commit de69f07

Browse files
author
Tom Barnes
committed
Add more debugging output to integration tests.
1 parent 5778723 commit de69f07

File tree

3 files changed

+44
-10
lines changed

3 files changed

+44
-10
lines changed

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

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -992,15 +992,20 @@ private void callShellScriptByExecToPod(
992992
.append(clusterName)
993993
.append("'");
994994
logger.info("Command to call kubectl sh file " + cmdKubectlSh);
995-
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-
}
995+
String resultStr =
996+
"Command= '"
997+
+ cmdKubectlSh
998+
+ "'"
999+
+ ", exitValue="
1000+
+ result.exitValue()
1001+
+ ", stdout='"
1002+
+ result.stdout()
1003+
+ "'"
1004+
+ ", stderr='"
1005+
+ result.stderr()
1006+
+ "'";
1007+
if (result.exitValue() != 0 || !resultStr.contains("Deployment State : completed"))
1008+
throw new RuntimeException("FAILURE: webapp deploy failed - " + resultStr);
10041009
}
10051010

10061011
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)