| ... | ... |
@@ -17,26 +17,21 @@ cd "${OS_ROOT}"
|
| 17 | 17 |
|
| 18 | 18 |
os::build::setup_env |
| 19 | 19 |
|
| 20 |
-export ETCD_HOST=${ETCD_HOST:-127.0.0.1}
|
|
| 20 |
+TMPDIR="${TMPDIR:-"/tmp"}"
|
|
| 21 |
+export BASETMPDIR="${BASETMPDIR:-${TMPDIR}/openshift-integration}"
|
|
| 22 |
+export API_SCHEME=${API_SCHEME:-http}
|
|
| 23 |
+export API_BIND_HOST="127.0.0.1" |
|
| 21 | 24 |
export ETCD_PORT=${ETCD_PORT:-44001}
|
| 22 | 25 |
export ETCD_PEER_PORT=${ETCD_PEER_PORT:-47001}
|
| 23 |
- |
|
| 24 |
-if ! which etcd >/dev/null 2>&1; then |
|
| 25 |
- if [[ ! -f ${OS_ROOT}/_tools/etcd/bin/etcd ]]; then
|
|
| 26 |
- echo "etcd must be in your PATH or installed in _tools/etcd/bin/ with hack/install-etcd.sh" |
|
| 27 |
- exit 1 |
|
| 28 |
- fi |
|
| 29 |
- export PATH="${OS_ROOT}/_tools/etcd/bin:$PATH"
|
|
| 30 |
-fi |
|
| 26 |
+export SUDO='' |
|
| 27 |
+setup_env_vars |
|
| 28 |
+reset_tmp_dir |
|
| 31 | 29 |
|
| 32 | 30 |
function cleanup() {
|
| 33 | 31 |
out=$? |
| 34 | 32 |
set +e |
| 35 |
- if [[ $out -ne 0 && -f "${etcdlog}" ]]; then
|
|
| 36 |
- cat "${etcdlog}"
|
|
| 37 |
- fi |
|
| 38 |
- kill "${ETCD_PID}" 1>&2 2>/dev/null
|
|
| 39 |
- echo |
|
| 33 |
+ |
|
| 34 |
+ cleanup_openshift |
|
| 40 | 35 |
echo "Complete" |
| 41 | 36 |
exit $out |
| 42 | 37 |
} |
| ... | ... |
@@ -47,47 +42,30 @@ package="${OS_TEST_PACKAGE:-test/integration}"
|
| 47 | 47 |
tags="${OS_TEST_TAGS:-integration !docker etcd}"
|
| 48 | 48 |
|
| 49 | 49 |
export GOMAXPROCS="$(grep "processor" -c /proc/cpuinfo 2>/dev/null || sysctl -n hw.logicalcpu 2>/dev/null || 1)" |
| 50 |
-TMPDIR="${TMPDIR:-"/tmp"}"
|
|
| 51 |
-export BASETMPDIR="${BASETMPDIR:-${TMPDIR}/openshift-integration}"
|
|
| 52 |
-rm -rf ${BASETMPDIR} | true
|
|
| 53 |
-mkdir -p ${BASETMPDIR}
|
|
| 54 | 50 |
|
| 55 | 51 |
echo |
| 56 | 52 |
echo "Test ${package} -tags='${tags}' ..."
|
| 57 | 53 |
echo |
| 58 | 54 |
|
| 59 | 55 |
# setup the test dirs |
| 60 |
-export ETCD_DIR=${BASETMPDIR}/etcd
|
|
| 61 |
-etcdlog="${BASETMPDIR}/etcd.log"
|
|
| 62 | 56 |
testdir="${OS_ROOT}/_output/testbin/${package}"
|
| 63 | 57 |
name="$(basename ${testdir})"
|
| 64 | 58 |
testexec="${testdir}/${name}.test"
|
| 65 | 59 |
mkdir -p "${testdir}"
|
| 66 |
-mkdir -p "${ETCD_DIR}"
|
|
| 67 | 60 |
|
| 68 | 61 |
# build the test executable (cgo must be disabled to have the symbol table available) |
| 69 | 62 |
pushd "${testdir}" &>/dev/null
|
| 70 | 63 |
echo "Building test executable..." |
| 71 | 64 |
CGO_ENABLED=0 go test -c -tags="${tags}" "${OS_GO_PACKAGE}/${package}"
|
| 72 | 65 |
popd &>/dev/null |
| 73 |
- |
|
| 74 |
-LOG_DIR="${BASETMPDIR}/logs"
|
|
| 75 |
-mkdir -p "${LOG_DIR}"
|
|
| 66 |
+ |
|
| 76 | 67 |
os::log::start_system_logger |
| 77 | 68 |
|
| 78 |
-# Start etcd |
|
| 79 |
-echo "Starting etcd..." |
|
| 80 |
-etcd -name test -data-dir ${ETCD_DIR} \
|
|
| 81 |
- --listen-peer-urls http://${ETCD_HOST}:${ETCD_PEER_PORT} \
|
|
| 82 |
- --listen-client-urls http://${ETCD_HOST}:${ETCD_PORT} \
|
|
| 83 |
- --initial-advertise-peer-urls http://${ETCD_HOST}:${ETCD_PEER_PORT} \
|
|
| 84 |
- --initial-cluster test=http://${ETCD_HOST}:${ETCD_PEER_PORT} \
|
|
| 85 |
- --advertise-client-urls http://${ETCD_HOST}:${ETCD_PORT} \
|
|
| 86 |
- &>"${etcdlog}" &
|
|
| 87 |
-export ETCD_PID=$! |
|
| 88 |
- |
|
| 89 |
-wait_for_url "http://${ETCD_HOST}:${ETCD_PORT}/version" "etcd: " 0.25 160
|
|
| 90 |
-curl -X PUT "http://${ETCD_HOST}:${ETCD_PORT}/v2/keys/_test"
|
|
| 69 |
+configure_os_server |
|
| 70 |
+openshift start etcd --config=${MASTER_CONFIG_DIR}/master-config.yaml &> ${LOG_DIR}/etcd.log &
|
|
| 71 |
+ |
|
| 72 |
+wait_for_url "http://${API_HOST}:${ETCD_PORT}/version" "etcd: " 0.25 160
|
|
| 73 |
+curl -X PUT "http://${API_HOST}:${ETCD_PORT}/v2/keys/_test"
|
|
| 91 | 74 |
echo |
| 92 | 75 |
|
| 93 | 76 |
function exectest() {
|
| ... | ... |
@@ -110,6 +88,12 @@ function exectest() {
|
| 110 | 110 |
else |
| 111 | 111 |
os::text::print_red "failed $1" |
| 112 | 112 |
echo "${out}"
|
| 113 |
+ |
|
| 114 |
+ # dump etcd for failing test |
|
| 115 |
+ echo "[INFO] Dumping etcd contents to ${ARTIFACT_DIR}/$1-etcd_dump.json"
|
|
| 116 |
+ curl -L "${API_SCHEME}://${API_HOST}:${ETCD_PORT}/v2/keys/?recursive=true" > "${ARTIFACT_DIR}/$1-etcd_dump.json"
|
|
| 117 |
+ echo |
|
| 118 |
+ |
|
| 113 | 119 |
exit 1 |
| 114 | 120 |
fi |
| 115 | 121 |
} |