Also, print etcd logs if integration test dies
| ... | ... |
@@ -150,7 +150,7 @@ os::util::sed "s/:7001$/:${ETCD_PEER_PORT}/g" ${SERVER_CONFIG_DIR}/master/master
|
| 150 | 150 |
OPENSHIFT_ON_PANIC=crash openshift start master \ |
| 151 | 151 |
--config=${MASTER_CONFIG_DIR}/master-config.yaml \
|
| 152 | 152 |
--loglevel=4 \ |
| 153 |
- 1>&2 2>"${LOG_DIR}/openshift.log" &
|
|
| 153 |
+ &>"${LOG_DIR}/openshift.log" &
|
|
| 154 | 154 |
OS_PID=$! |
| 155 | 155 |
|
| 156 | 156 |
if [[ "${API_SCHEME}" == "https" ]]; then
|
| ... | ... |
@@ -36,10 +36,15 @@ set -e |
| 36 | 36 |
|
| 37 | 37 |
|
| 38 | 38 |
function cleanup() {
|
| 39 |
+ out=$? |
|
| 39 | 40 |
set +e |
| 41 |
+ if [[ $out -ne 0 && -f "${etcdlog}" ]]; then
|
|
| 42 |
+ cat "${etcdlog}"
|
|
| 43 |
+ fi |
|
| 40 | 44 |
kill "${ETCD_PID}" 1>&2 2>/dev/null
|
| 41 | 45 |
echo |
| 42 | 46 |
echo "Complete" |
| 47 |
+ exit $out |
|
| 43 | 48 |
} |
| 44 | 49 |
|
| 45 | 50 |
|
| ... | ... |
@@ -59,34 +64,34 @@ echo "Test ${package} -tags='${tags}' ..."
|
| 59 | 59 |
echo |
| 60 | 60 |
|
| 61 | 61 |
# setup the test dirs |
| 62 |
+export ETCD_DIR=${BASETMPDIR}/etcd
|
|
| 63 |
+etcdlog="${ETCD_DIR}/etcd.log"
|
|
| 62 | 64 |
testdir="${OS_ROOT}/_output/testbin/${package}"
|
| 63 | 65 |
name="$(basename ${testdir})"
|
| 64 | 66 |
testexec="${testdir}/${name}.test"
|
| 65 | 67 |
mkdir -p "${testdir}"
|
| 68 |
+mkdir -p "${ETCD_DIR}"
|
|
| 66 | 69 |
|
| 67 | 70 |
# build the test executable (cgo must be disabled to have the symbol table available) |
| 68 |
-pushd "${testdir}" 2>&1 >/dev/null
|
|
| 71 |
+pushd "${testdir}" &>/dev/null
|
|
| 69 | 72 |
CGO_ENABLED=0 go test -c -tags="${tags}" "${OS_GO_PACKAGE}/${package}"
|
| 70 |
-popd 2>&1 >/dev/null |
|
| 73 |
+popd &>/dev/null |
|
| 71 | 74 |
|
| 72 | 75 |
|
| 73 | 76 |
# Start etcd |
| 74 |
-export ETCD_DIR=${BASETMPDIR}/etcd
|
|
| 75 | 77 |
etcd -name test -data-dir ${ETCD_DIR} \
|
| 76 | 78 |
--listen-peer-urls http://${ETCD_HOST}:${ETCD_PEER_PORT} \
|
| 77 | 79 |
--listen-client-urls http://${ETCD_HOST}:${ETCD_PORT} \
|
| 78 | 80 |
--initial-advertise-peer-urls http://${ETCD_HOST}:${ETCD_PEER_PORT} \
|
| 79 | 81 |
--initial-cluster test=http://${ETCD_HOST}:${ETCD_PEER_PORT} \
|
| 80 | 82 |
--advertise-client-urls http://${ETCD_HOST}:${ETCD_PORT} \
|
| 81 |
- >/dev/null 2>/dev/null & |
|
| 83 |
+ &>"${etcdlog}" &
|
|
| 82 | 84 |
export ETCD_PID=$! |
| 83 | 85 |
|
| 84 |
-wait_for_url "http://${ETCD_HOST}:${ETCD_PORT}/version" "etcd: " 0.25 80
|
|
| 86 |
+wait_for_url "http://${ETCD_HOST}:${ETCD_PORT}/version" "etcd: " 0.25 160
|
|
| 85 | 87 |
curl -X PUT "http://${ETCD_HOST}:${ETCD_PORT}/v2/keys/_test"
|
| 86 | 88 |
echo |
| 87 | 89 |
|
| 88 |
- |
|
| 89 |
- |
|
| 90 | 90 |
trap cleanup EXIT SIGINT |
| 91 | 91 |
|
| 92 | 92 |
function exectest() {
|
| ... | ... |
@@ -132,10 +137,10 @@ export childargs |
| 132 | 132 |
# hack/test-integration.sh "(WatchBuilds|Template)" |
| 133 | 133 |
|
| 134 | 134 |
# run each test as its own process |
| 135 |
-pushd "./${package}" 2>&1 >/dev/null
|
|
| 135 |
+pushd "./${package}" &>/dev/null
|
|
| 136 | 136 |
time go run "${OS_ROOT}/hack/listtests.go" -prefix="${OS_GO_PACKAGE}/${package}.Test" "${testdir}" \
|
| 137 | 137 |
| grep --color=never -E "${1-Test}" \
|
| 138 | 138 |
| xargs -I {} -n 1 bash -c "exectest {} ${@:2}" # "${testexec}" -test.run="^{}$" "${@:2}"
|
| 139 |
-popd 2>&1 >/dev/null |
|
| 139 |
+popd &>/dev/null |
|
| 140 | 140 |
|
| 141 | 141 |
ret=$?; ENDTIME=$(date +%s); echo "$0 took $(($ENDTIME - $STARTTIME)) seconds"; exit "$ret" |
| ... | ... |
@@ -18,7 +18,7 @@ function cleanup() |
| 18 | 18 |
if [ $out -ne 0 ]; then |
| 19 | 19 |
echo "[FAIL] !!!!! Generate Failed !!!!" |
| 20 | 20 |
echo |
| 21 |
- cat "${TEMP_DIR}/openshift.log"
|
|
| 21 |
+ tail -100 "${LOG_DIR}/openshift.log"
|
|
| 22 | 22 |
echo |
| 23 | 23 |
echo ------------------------------------- |
| 24 | 24 |
echo |
| ... | ... |
@@ -42,7 +42,7 @@ export ETCD_PORT=34001 |
| 42 | 42 |
export ETCD_PEER_PORT=37001 |
| 43 | 43 |
export SUDO='' |
| 44 | 44 |
setup_env_vars |
| 45 |
-reset_tmp_dir |
|
| 45 |
+reset_tmp_dir |
|
| 46 | 46 |
configure_os_server |
| 47 | 47 |
|
| 48 | 48 |
|
| ... | ... |
@@ -146,7 +146,7 @@ function start_os_server {
|
| 146 | 146 |
--master-config=${MASTER_CONFIG_DIR}/master-config.yaml \
|
| 147 | 147 |
--node-config=${NODE_CONFIG_DIR}/node-config.yaml \
|
| 148 | 148 |
--loglevel=4 \ |
| 149 |
- &> "${LOG_DIR}/openshift.log" &
|
|
| 149 |
+ &>"${LOG_DIR}/openshift.log" &
|
|
| 150 | 150 |
export OS_PID=$! |
| 151 | 151 |
|
| 152 | 152 |
echo "[INFO] OpenShift server start at: " |
| ... | ... |
@@ -181,7 +181,7 @@ function start_os_master {
|
| 181 | 181 |
${sudo} env "PATH=${PATH}" OPENSHIFT_PROFILE=web OPENSHIFT_ON_PANIC=crash openshift start master \
|
| 182 | 182 |
--config=${MASTER_CONFIG_DIR}/master-config.yaml \
|
| 183 | 183 |
--loglevel=4 \ |
| 184 |
- &> "${LOG_DIR}/openshift.log" &
|
|
| 184 |
+ &>"${LOG_DIR}/openshift.log" &
|
|
| 185 | 185 |
export OS_PID=$! |
| 186 | 186 |
|
| 187 | 187 |
echo "[INFO] OpenShift server start at: " |