forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-end-to-end-docker.sh
executable file
·87 lines (64 loc) · 2.18 KB
/
test-end-to-end-docker.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
# This script tests the high level end-to-end functionality demonstrated
# as part of the examples/sample-app
STARTTIME=$(date +%s)
source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
os::log::info "Starting containerized end-to-end test"
unset KUBECONFIG
os::util::environment::use_sudo
os::util::environment::setup_all_server_vars "test-end-to-end-docker/"
function cleanup()
{
out=$?
echo
if [ $out -ne 0 ]; then
echo "[FAIL] !!!!! Test Failed !!!!"
else
os::log::info "Test Succeeded"
fi
echo
set +e
os::cleanup::dump_container_logs
# pull information out of the server log so that we can get failure management in jenkins to highlight it and
# really have it smack people in their logs. This is a severe correctness problem
grep -ra5 "CACHE.*ALTERED" ${LOG_DIR}/containers
os::cleanup::dump_etcd
if [[ -z "${SKIP_TEARDOWN-}" ]]; then
os::log::info "remove the openshift container"
docker stop origin
docker rm origin
os::cleanup::containers
set -u
fi
journalctl --unit docker.service --since -15minutes > "${LOG_DIR}/docker.log"
truncate_large_logs
set -e
os::log::info "Exiting"
ENDTIME=$(date +%s); echo "$0 took $(($ENDTIME - $STARTTIME)) seconds"
exit $out
}
trap "cleanup" EXIT INT TERM
os::log::system::start
out=$(
set +e
docker stop origin 2>&1
docker rm origin 2>&1
set -e
)
# Setup
os::log::info "openshift version: `openshift version`"
os::log::info "oc version: `oc version`"
os::log::info "Using images: ${USE_IMAGES}"
os::log::info "Starting OpenShift containerized server"
oc cluster up --server-loglevel=4 --version="${TAG}" \
--host-data-dir="${VOLUME_DIR}/etcd" \
--host-volumes-dir="${VOLUME_DIR}"
oc cluster status
IMAGE_WORKING_DIR=/var/lib/origin
docker cp origin:${IMAGE_WORKING_DIR}/openshift.local.config ${BASETMPDIR}
export ADMIN_KUBECONFIG="${MASTER_CONFIG_DIR}/admin.kubeconfig"
export CLUSTER_ADMIN_CONTEXT=$(oc config view --config=${ADMIN_KUBECONFIG} --flatten -o template --template='{{index . "current-context"}}')
sudo chmod -R a+rwX "${ADMIN_KUBECONFIG}"
export KUBECONFIG="${ADMIN_KUBECONFIG}"
os::log::info "To debug: export KUBECONFIG=$ADMIN_KUBECONFIG"
${OS_ROOT}/test/end-to-end/core.sh