| ... | ... |
@@ -136,8 +136,8 @@ function os::cmd::try_until_text() {
|
| 136 | 136 |
|
| 137 | 137 |
# In order to harvest stderr and stdout at the same time into different buckets, we need to stick them into files |
| 138 | 138 |
# in an intermediate step |
| 139 |
-TMPDIR="${TMPDIR:-"/tmp"}"
|
|
| 140 |
-os_cmd_internal_tmpdir="${TMPDIR}/openshift/test/cmd"
|
|
| 139 |
+BASETMPDIR="${TMPDIR:-"/tmp"}/openshift"
|
|
| 140 |
+os_cmd_internal_tmpdir="${BASETMPDIR}/test-cmd"
|
|
| 141 | 141 |
os_cmd_internal_tmpout="${os_cmd_internal_tmpdir}/tmp_stdout.log"
|
| 142 | 142 |
os_cmd_internal_tmperr="${os_cmd_internal_tmpdir}/tmp_stderr.log"
|
| 143 | 143 |
|
| 84 | 82 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,253 @@ |
| 0 |
+#!/bin/bash |
|
| 1 |
+ |
|
| 2 |
+# This script holds library functions for setting up the shell environment for OpenShift scripts |
|
| 3 |
+# |
|
| 4 |
+# This script assumes $OS_ROOT is set before being sourced |
|
| 5 |
+source "${OS_ROOT}/hack/util.sh"
|
|
| 6 |
+ |
|
| 7 |
+# os::util::environment::use_sudo updates $USE_SUDO to be 'true', so that later scripts choosing between |
|
| 8 |
+# execution using 'sudo' and execution without it chose to use 'sudo' |
|
| 9 |
+# |
|
| 10 |
+# Globals: |
|
| 11 |
+# None |
|
| 12 |
+# Arguments: |
|
| 13 |
+# None |
|
| 14 |
+# Returns: |
|
| 15 |
+# - export USE_SUDO |
|
| 16 |
+function os::util::environment::use_sudo() {
|
|
| 17 |
+ export USE_SUDO=true |
|
| 18 |
+} |
|
| 19 |
+ |
|
| 20 |
+# os::util::environment::setup_time_vars sets up environment variables that describe durations of time |
|
| 21 |
+# These variables can be used to specify times for other utility functions |
|
| 22 |
+# |
|
| 23 |
+# Globals: |
|
| 24 |
+# None |
|
| 25 |
+# Arguments: |
|
| 26 |
+# None |
|
| 27 |
+# Returns: |
|
| 28 |
+# - export TIME_MS |
|
| 29 |
+# - export TIME_SEC |
|
| 30 |
+# - export TIME_MIN |
|
| 31 |
+function os::util::environment::setup_time_vars() {
|
|
| 32 |
+ export TIME_MS=1 |
|
| 33 |
+ export TIME_SEC="$(( 1000 * ${TIME_MS} ))"
|
|
| 34 |
+ export TIME_MIN="$(( 60 * ${TIME_SEC} ))"
|
|
| 35 |
+} |
|
| 36 |
+ |
|
| 37 |
+# os::util::environment::setup_all_server_vars sets up all environment variables necessary to configure and start an OpenShift server |
|
| 38 |
+# |
|
| 39 |
+# Globals: |
|
| 40 |
+# - OS_ROOT |
|
| 41 |
+# - PATH |
|
| 42 |
+# - TMPDIR |
|
| 43 |
+# - LOG_DIR |
|
| 44 |
+# - ARTIFACT_DIR |
|
| 45 |
+# - KUBELET_SCHEME |
|
| 46 |
+# - KUBELET_BIND_HOST |
|
| 47 |
+# - KUBELET_HOST |
|
| 48 |
+# - KUBELET_PORT |
|
| 49 |
+# - BASETMPDIR |
|
| 50 |
+# - ETCD_PORT |
|
| 51 |
+# - ETCD_PEER_PORT |
|
| 52 |
+# - API_BIND_HOST |
|
| 53 |
+# - API_HOST |
|
| 54 |
+# - API_PORT |
|
| 55 |
+# - API_SCHEME |
|
| 56 |
+# - PUBLIC_MASTER_HOST |
|
| 57 |
+# - USE_IMAGES |
|
| 58 |
+# Arguments: |
|
| 59 |
+# - 1: the path under the root temporary directory for OpenShift where these subdirectories should be made |
|
| 60 |
+# Returns: |
|
| 61 |
+# - export PATH |
|
| 62 |
+# - export BASETMPDIR |
|
| 63 |
+# - export LOG_DIR |
|
| 64 |
+# - export VOLUME_DIR |
|
| 65 |
+# - export ARTIFACT_DIR |
|
| 66 |
+# - export FAKE_HOME_DIR |
|
| 67 |
+# - export HOME |
|
| 68 |
+# - export KUBELET_SCHEME |
|
| 69 |
+# - export KUBELET_BIND_HOST |
|
| 70 |
+# - export KUBELET_HOST |
|
| 71 |
+# - export KUBELET_PORT |
|
| 72 |
+# - export ETCD_PORT |
|
| 73 |
+# - export ETCD_PEER_PORT |
|
| 74 |
+# - export ETCD_DATA_DIR |
|
| 75 |
+# - export API_BIND_HOST |
|
| 76 |
+# - export API_HOST |
|
| 77 |
+# - export API_PORT |
|
| 78 |
+# - export API_SCHEME |
|
| 79 |
+# - export CURL_CA_BUNDLE |
|
| 80 |
+# - export CURL_CERT |
|
| 81 |
+# - export CURL_KEY |
|
| 82 |
+# - export SERVER_CONFIG_DIR |
|
| 83 |
+# - export MASTER_CONFIG_DIR |
|
| 84 |
+# - export NODE_CONFIG_DIR |
|
| 85 |
+# - export USE_IMAGES |
|
| 86 |
+# - export TAG |
|
| 87 |
+function os::util::environment::setup_all_server_vars() {
|
|
| 88 |
+ local subtempdir=$1 |
|
| 89 |
+ |
|
| 90 |
+ os::util::environment::update_path_var |
|
| 91 |
+ os::util::environment::setup_tmpdir_vars "${subtempdir}"
|
|
| 92 |
+ os::util::environment::setup_kubelet_vars |
|
| 93 |
+ os::util::environment::setup_etcd_vars |
|
| 94 |
+ os::util::environment::setup_server_vars |
|
| 95 |
+ os::util::environment::setup_images_vars |
|
| 96 |
+} |
|
| 97 |
+ |
|
| 98 |
+# os::util::environment::update_path_var updates $PATH so that OpenShift binaries are available |
|
| 99 |
+# |
|
| 100 |
+# Globals: |
|
| 101 |
+# - OS_ROOT |
|
| 102 |
+# - PATH |
|
| 103 |
+# Arguments: |
|
| 104 |
+# None |
|
| 105 |
+# Returns: |
|
| 106 |
+# - export PATH |
|
| 107 |
+function os::util::environment::update_path_var() {
|
|
| 108 |
+ export PATH="${OS_ROOT}/_output/local/bin/$(os::util::host_platform):${PATH}"
|
|
| 109 |
+} |
|
| 110 |
+ |
|
| 111 |
+# os::util::environment::setup_misc_tmpdir_vars sets up temporary directory path variables |
|
| 112 |
+# |
|
| 113 |
+# Globals: |
|
| 114 |
+# - TMPDIR |
|
| 115 |
+# - LOG_DIR |
|
| 116 |
+# - ARTIFACT_DIR |
|
| 117 |
+# Arguments: |
|
| 118 |
+# - 1: the path under the root temporary directory for OpenShift where these subdirectories should be made |
|
| 119 |
+# Returns: |
|
| 120 |
+# - export BASETMPDIR |
|
| 121 |
+# - export LOG_DIR |
|
| 122 |
+# - export VOLUME_DIR |
|
| 123 |
+# - export ARTIFACT_DIR |
|
| 124 |
+# - export FAKE_HOME_DIR |
|
| 125 |
+# - export HOME |
|
| 126 |
+function os::util::environment::setup_tmpdir_vars() {
|
|
| 127 |
+ local sub_dir=$1 |
|
| 128 |
+ |
|
| 129 |
+ export BASETMPDIR="${TPMDIR:-/tmp}/openshift/${sub_dir}"
|
|
| 130 |
+ export LOG_DIR="${LOG_DIR:-${BASETMPDIR}/logs}"
|
|
| 131 |
+ export VOLUME_DIR="${BASETMPDIR}/volumes"
|
|
| 132 |
+ export ARTIFACT_DIR="${ARTIFACT_DIR:-${BASETMPDIR}/artifacts}"
|
|
| 133 |
+ |
|
| 134 |
+ # change the location of $HOME so no one does anything naughty |
|
| 135 |
+ export FAKE_HOME_DIR="${BASETMPDIR}/openshift.local.home"
|
|
| 136 |
+ export HOME="${FAKE_HOME_DIR}"
|
|
| 137 |
+ |
|
| 138 |
+ mkdir -p "${BASETMPDIR}" "${LOG_DIR}" "${VOLUME_DIR}" "${ARTIFACT_DIR}" "${HOME}"
|
|
| 139 |
+} |
|
| 140 |
+ |
|
| 141 |
+# os::util::environment::setup_kubelet_vars sets up environment variables necessary for interacting with the kubelet |
|
| 142 |
+# |
|
| 143 |
+# Globals: |
|
| 144 |
+# - KUBELET_SCHEME |
|
| 145 |
+# - KUBELET_BIND_HOST |
|
| 146 |
+# - KUBELET_HOST |
|
| 147 |
+# - KUBELET_PORT |
|
| 148 |
+# Arguments: |
|
| 149 |
+# None |
|
| 150 |
+# Returns: |
|
| 151 |
+# - export KUBELET_SCHEME |
|
| 152 |
+# - export KUBELET_BIND_HOST |
|
| 153 |
+# - export KUBELET_HOST |
|
| 154 |
+# - export KUBELET_PORT |
|
| 155 |
+function os::util::environment::setup_kubelet_vars() {
|
|
| 156 |
+ export KUBELET_SCHEME="${KUBELET_SCHEME:-https}"
|
|
| 157 |
+ export KUBELET_BIND_HOST="${KUBELET_BIND_HOST:-$(openshift start --print-ip)}"
|
|
| 158 |
+ export KUBELET_HOST="${KUBELET_HOST:-${KUBELET_BIND_HOST}}"
|
|
| 159 |
+ export KUBELET_PORT="${KUBELET_PORT:-10250}"
|
|
| 160 |
+} |
|
| 161 |
+ |
|
| 162 |
+# os::util::environment::setup_etcd_vars sets up environment variables necessary for interacting with etcd |
|
| 163 |
+# |
|
| 164 |
+# Globals: |
|
| 165 |
+# - BASETMPDIR |
|
| 166 |
+# - ETCD_HOST |
|
| 167 |
+# - ETCD_PORT |
|
| 168 |
+# - ETCD_PEER_PORT |
|
| 169 |
+# Arguments: |
|
| 170 |
+# None |
|
| 171 |
+# Returns: |
|
| 172 |
+# - export ETCD_HOST |
|
| 173 |
+# - export ETCD_PORT |
|
| 174 |
+# - export ETCD_PEER_PORT |
|
| 175 |
+# - export ETCD_DATA_DIR |
|
| 176 |
+function os::util::environment::setup_etcd_vars() {
|
|
| 177 |
+ export ETCD_HOST="${ETCD_HOST:-127.0.0.1}"
|
|
| 178 |
+ export ETCD_PORT="${ETCD_PORT:-4001}"
|
|
| 179 |
+ export ETCD_PEER_PORT="${ETCD_PEER_PORT:-7001}"
|
|
| 180 |
+ |
|
| 181 |
+ export ETCD_DATA_DIR="${BASETMPDIR}/etcd"
|
|
| 182 |
+ |
|
| 183 |
+ mkdir -p "${ETCD_DATA_DIR}"
|
|
| 184 |
+} |
|
| 185 |
+ |
|
| 186 |
+# os::util::environment::setup_server_vars sets up environment variables necessary for interacting with the server |
|
| 187 |
+# |
|
| 188 |
+# Globals: |
|
| 189 |
+# - BASETMPDIR |
|
| 190 |
+# - KUBELET_HOST |
|
| 191 |
+# - API_BIND_HOST |
|
| 192 |
+# - API_HOST |
|
| 193 |
+# - API_PORT |
|
| 194 |
+# - API_SCHEME |
|
| 195 |
+# - PUBLIC_MASTER_HOST |
|
| 196 |
+# Arguments: |
|
| 197 |
+# None |
|
| 198 |
+# Returns: |
|
| 199 |
+# - export API_BIND_HOST |
|
| 200 |
+# - export API_HOST |
|
| 201 |
+# - export API_PORT |
|
| 202 |
+# - export API_SCHEME |
|
| 203 |
+# - export CURL_CA_BUNDLE |
|
| 204 |
+# - export CURL_CERT |
|
| 205 |
+# - export CURL_KEY |
|
| 206 |
+# - export SERVER_CONFIG_DIR |
|
| 207 |
+# - export MASTER_CONFIG_DIR |
|
| 208 |
+# - export NODE_CONFIG_DIR |
|
| 209 |
+function os::util::environment::setup_server_vars() {
|
|
| 210 |
+ export API_BIND_HOST="${API_BIND_HOST:-$(openshift start --print-ip)}"
|
|
| 211 |
+ export API_HOST="${API_HOST:-${API_BIND_HOST}}"
|
|
| 212 |
+ export API_PORT="${API_PORT:-8443}"
|
|
| 213 |
+ export API_SCHEME="${API_SCHEME:-https}"
|
|
| 214 |
+ |
|
| 215 |
+ export MASTER_ADDR="${API_SCHEME}://${API_HOST}:${API_PORT}"
|
|
| 216 |
+ export PUBLIC_MASTER_HOST="${PUBLIC_MASTER_HOST:-${API_HOST}}"
|
|
| 217 |
+ |
|
| 218 |
+ export SERVER_CONFIG_DIR="${BASETMPDIR}/openshift.local.config"
|
|
| 219 |
+ export MASTER_CONFIG_DIR="${SERVER_CONFIG_DIR}/master"
|
|
| 220 |
+ export NODE_CONFIG_DIR="${SERVER_CONFIG_DIR}/node-${KUBELET_HOST}"
|
|
| 221 |
+ |
|
| 222 |
+ mkdir -p "${SERVER_CONFIG_DIR}" "${MASTER_CONFIG_DIR}" "${NODE_CONFIG_DIR}"
|
|
| 223 |
+ |
|
| 224 |
+ if [[ "${API_SCHEME}" == "https" ]]; then
|
|
| 225 |
+ export CURL_CA_BUNDLE="${MASTER_CONFIG_DIR}/ca.crt"
|
|
| 226 |
+ export CURL_CERT="${MASTER_CONFIG_DIR}/admin.crt"
|
|
| 227 |
+ export CURL_KEY="${MASTER_CONFIG_DIR}/admin.key"
|
|
| 228 |
+ fi |
|
| 229 |
+} |
|
| 230 |
+ |
|
| 231 |
+# os::util::environment::setup_images_vars sets up environment variables necessary for interacting with release images |
|
| 232 |
+# |
|
| 233 |
+# Globals: |
|
| 234 |
+# - OS_ROOT |
|
| 235 |
+# - USE_IMAGES |
|
| 236 |
+# Arguments: |
|
| 237 |
+# None |
|
| 238 |
+# Returns: |
|
| 239 |
+# - export USE_IMAGES |
|
| 240 |
+# - export TAG |
|
| 241 |
+function os::util::environment::setup_images_vars() {
|
|
| 242 |
+ # Use either the latest release built images, or latest. |
|
| 243 |
+ if [[ -z "${USE_IMAGES-}" ]]; then
|
|
| 244 |
+ export TAG='latest' |
|
| 245 |
+ export USE_IMAGES='openshift/origin-${component}:latest'
|
|
| 246 |
+ |
|
| 247 |
+ if [[ -e "${OS_ROOT}/_output/local/releases/.commit" ]]; then
|
|
| 248 |
+ export TAG="$(cat "${OS_ROOT}/_output/local/releases/.commit")"
|
|
| 249 |
+ export USE_IMAGES="openshift/origin-\${component}:${TAG}"
|
|
| 250 |
+ fi |
|
| 251 |
+ fi |
|
| 252 |
+} |
| ... | ... |
@@ -12,6 +12,7 @@ OS_ROOT=$(dirname "${BASH_SOURCE}")/..
|
| 12 | 12 |
cd "${OS_ROOT}"
|
| 13 | 13 |
source "${OS_ROOT}/hack/util.sh"
|
| 14 | 14 |
source "${OS_ROOT}/hack/lib/log.sh"
|
| 15 |
+source "${OS_ROOT}/hack/lib/util/environment.sh"
|
|
| 15 | 16 |
os::log::install_errexit |
| 16 | 17 |
|
| 17 | 18 |
function cleanup() |
| ... | ... |
@@ -57,18 +58,14 @@ tests=( $(find_tests ${1:-.*}) )
|
| 57 | 57 |
# Setup environment |
| 58 | 58 |
|
| 59 | 59 |
# test-cmd specific defaults |
| 60 |
-TMPDIR="${TMPDIR:-"/tmp"}"
|
|
| 61 |
-BASETMPDIR="${BASETMPDIR:-${TMPDIR}/openshift-cmd}"
|
|
| 62 |
-LOG_DIR=${BASETMPDIR}/logs
|
|
| 63 | 60 |
API_HOST=${API_HOST:-127.0.0.1}
|
| 64 | 61 |
export API_PORT=${API_PORT:-28443}
|
| 65 | 62 |
|
| 66 | 63 |
export ETCD_HOST=${ETCD_HOST:-127.0.0.1}
|
| 67 | 64 |
export ETCD_PORT=${ETCD_PORT:-24001}
|
| 68 | 65 |
export ETCD_PEER_PORT=${ETCD_PEER_PORT:-27001}
|
| 69 |
-setup_env_vars |
|
| 70 |
-export SUDO='' |
|
| 71 |
-mkdir -p "${ETCD_DATA_DIR}" "${VOLUME_DIR}" "${FAKE_HOME_DIR}" "${MASTER_CONFIG_DIR}" "${NODE_CONFIG_DIR}" "${LOG_DIR}"
|
|
| 66 |
+ |
|
| 67 |
+os::util::environment::setup_all_server_vars "test-cmd/" |
|
| 72 | 68 |
reset_tmp_dir |
| 73 | 69 |
|
| 74 | 70 |
echo "Logging to ${LOG_DIR}..."
|
| ... | ... |
@@ -79,7 +76,7 @@ os::log::start_system_logger |
| 79 | 79 |
unset KUBECONFIG |
| 80 | 80 |
|
| 81 | 81 |
# test wrapper functions |
| 82 |
-${OS_ROOT}/hack/test-cmd_util.sh > ${BASETMPDIR}/wrappers.txt 2>&1
|
|
| 82 |
+${OS_ROOT}/hack/test-cmd_util.sh > ${LOG_DIR}/wrappers_test.log 2>&1
|
|
| 83 | 83 |
|
| 84 | 84 |
|
| 85 | 85 |
# handle profiling defaults |
| ... | ... |
@@ -11,7 +11,8 @@ source "${OS_ROOT}/hack/util.sh"
|
| 11 | 11 |
source "${OS_ROOT}/hack/cmd_util.sh"
|
| 12 | 12 |
os::log::install_errexit |
| 13 | 13 |
|
| 14 |
-JUNIT_OUTPUT_FILE=/tmp/openshift-cmd/junit_output.txt |
|
| 14 |
+BASETMPDIR="${TMPDIR:-/tmp}/openshift/test-tools"
|
|
| 15 |
+JUNIT_OUTPUT_FILE="${BASETMPDIR}/junit_output.txt"
|
|
| 15 | 16 |
|
| 16 | 17 |
# set verbosity so we can see that command output renders correctly |
| 17 | 18 |
VERBOSE=1 |
| ... | ... |
@@ -11,14 +11,14 @@ STARTTIME=$(date +%s) |
| 11 | 11 |
OS_ROOT=$(dirname "${BASH_SOURCE}")/..
|
| 12 | 12 |
source "${OS_ROOT}/hack/util.sh"
|
| 13 | 13 |
source "${OS_ROOT}/hack/lib/log.sh"
|
| 14 |
+source "${OS_ROOT}/hack/lib/util/environment.sh"
|
|
| 14 | 15 |
|
| 15 | 16 |
echo "[INFO] Starting containerized end-to-end test" |
| 16 | 17 |
|
| 17 | 18 |
unset KUBECONFIG |
| 18 | 19 |
|
| 19 |
-TMPDIR="${TMPDIR:-"/tmp"}"
|
|
| 20 |
-BASETMPDIR="${BASETMPDIR:-${TMPDIR}/openshift-e2e-containerized}"
|
|
| 21 |
-setup_env_vars |
|
| 20 |
+os::util::environment::setup_all_server_vars "test-end-to-end-docker/" |
|
| 21 |
+os::util::environment::use_sudo |
|
| 22 | 22 |
reset_tmp_dir |
| 23 | 23 |
|
| 24 | 24 |
function cleanup() |
| ... | ... |
@@ -65,8 +65,7 @@ function cleanup() |
| 65 | 65 |
exit $out |
| 66 | 66 |
} |
| 67 | 67 |
|
| 68 |
-trap "exit" INT TERM |
|
| 69 |
-trap "cleanup" EXIT |
|
| 68 |
+trap "cleanup" EXIT INT TERM |
|
| 70 | 69 |
|
| 71 | 70 |
os::log::start_system_logger |
| 72 | 71 |
|
| ... | ... |
@@ -11,6 +11,7 @@ STARTTIME=$(date +%s) |
| 11 | 11 |
OS_ROOT=$(dirname "${BASH_SOURCE}")/..
|
| 12 | 12 |
source "${OS_ROOT}/hack/util.sh"
|
| 13 | 13 |
source "${OS_ROOT}/hack/lib/log.sh"
|
| 14 |
+source "${OS_ROOT}/hack/lib/util/environment.sh"
|
|
| 14 | 15 |
os::log::install_errexit |
| 15 | 16 |
|
| 16 | 17 |
ensure_iptables_or_die |
| ... | ... |
@@ -39,9 +40,8 @@ trap "cleanup" EXIT |
| 39 | 39 |
|
| 40 | 40 |
|
| 41 | 41 |
# Start All-in-one server and wait for health |
| 42 |
-TMPDIR="${TMPDIR:-"/tmp"}"
|
|
| 43 |
-BASETMPDIR="${BASETMPDIR:-${TMPDIR}/openshift-e2e}"
|
|
| 44 |
-setup_env_vars |
|
| 42 |
+os::util::environment::setup_all_server_vars "test-end-to-end/" |
|
| 43 |
+os::util::environment::use_sudo |
|
| 45 | 44 |
reset_tmp_dir |
| 46 | 45 |
|
| 47 | 46 |
os::log::start_system_logger |
| ... | ... |
@@ -10,6 +10,7 @@ source "${OS_ROOT}/hack/common.sh"
|
| 10 | 10 |
source "${OS_ROOT}/hack/util.sh"
|
| 11 | 11 |
source "${OS_ROOT}/hack/text.sh"
|
| 12 | 12 |
source "${OS_ROOT}/hack/lib/log.sh"
|
| 13 |
+source "${OS_ROOT}/hack/lib/util/environment.sh"
|
|
| 13 | 14 |
os::log::install_errexit |
| 14 | 15 |
|
| 15 | 16 |
# Go to the top of the tree. |
| ... | ... |
@@ -17,14 +18,11 @@ cd "${OS_ROOT}"
|
| 17 | 17 |
|
| 18 | 18 |
os::build::setup_env |
| 19 | 19 |
|
| 20 |
-TMPDIR="${TMPDIR:-"/tmp"}"
|
|
| 21 |
-export BASETMPDIR="${BASETMPDIR:-${TMPDIR}/openshift-integration}"
|
|
| 22 |
-export API_SCHEME=${API_SCHEME:-http}
|
|
| 20 |
+export API_SCHEME="http" |
|
| 23 | 21 |
export API_BIND_HOST="127.0.0.1" |
| 24 | 22 |
export ETCD_PORT=${ETCD_PORT:-44001}
|
| 25 | 23 |
export ETCD_PEER_PORT=${ETCD_PEER_PORT:-47001}
|
| 26 |
-export SUDO='' |
|
| 27 |
-setup_env_vars |
|
| 24 |
+os::util::environment::setup_all_server_vars "test-integration/" |
|
| 28 | 25 |
reset_tmp_dir |
| 29 | 26 |
|
| 30 | 27 |
function cleanup() {
|
| ... | ... |
@@ -13,13 +13,6 @@ source "${OS_ROOT}/hack/util.sh"
|
| 13 | 13 |
source "${OS_ROOT}/hack/cmd_util.sh"
|
| 14 | 14 |
os::log::install_errexit |
| 15 | 15 |
|
| 16 |
- |
|
| 17 |
-for tool in ${OS_ROOT}/tools/*; do
|
|
| 18 |
- test_file=${tool}/test/integration.sh
|
|
| 19 |
- if [ -e ${test_file} ]; then
|
|
| 20 |
- # if the tool exposes an integration test, run it |
|
| 21 |
- os::cmd::expect_success "${test_file}"
|
|
| 22 |
- fi |
|
| 23 |
-done |
|
| 16 |
+os::cmd::expect_success 'tools/junitreport/test/integration.sh' |
|
| 24 | 17 |
|
| 25 | 18 |
echo "test-tools: ok" |
| 26 | 19 |
\ No newline at end of file |
| ... | ... |
@@ -8,6 +8,7 @@ set -o pipefail |
| 8 | 8 |
|
| 9 | 9 |
OS_ROOT=$(dirname "${BASH_SOURCE}")/..
|
| 10 | 10 |
source "${OS_ROOT}/hack/util.sh"
|
| 11 |
+source "${OS_ROOT}/hack/lib/util/environment.sh"
|
|
| 11 | 12 |
os::log::install_errexit |
| 12 | 13 |
|
| 13 | 14 |
function cleanup() |
| ... | ... |
@@ -29,19 +30,13 @@ function cleanup() |
| 29 | 29 |
trap "exit" INT TERM |
| 30 | 30 |
trap "cleanup" EXIT |
| 31 | 31 |
|
| 32 |
-set -e |
|
| 33 |
- |
|
| 34 |
- |
|
| 35 |
-TMPDIR="${TMPDIR:-"/tmp"}"
|
|
| 36 |
-BASETMPDIR="${TMPDIR}/openshift-swagger"
|
|
| 37 | 32 |
export ALL_IP_ADDRESSES=127.0.0.1 |
| 38 | 33 |
export SERVER_HOSTNAME_LIST=127.0.0.1 |
| 39 | 34 |
export API_BIND_HOST=127.0.0.1 |
| 40 | 35 |
export API_PORT=38443 |
| 41 | 36 |
export ETCD_PORT=34001 |
| 42 | 37 |
export ETCD_PEER_PORT=37001 |
| 43 |
-export SUDO='' |
|
| 44 |
-setup_env_vars |
|
| 38 |
+os::util::environment::setup_all_server_vars "generate-swagger-spec/" |
|
| 45 | 39 |
reset_tmp_dir |
| 46 | 40 |
configure_os_server |
| 47 | 41 |
|
| ... | ... |
@@ -2,65 +2,34 @@ |
| 2 | 2 |
|
| 3 | 3 |
# Provides simple utility functions |
| 4 | 4 |
|
| 5 |
-TIME_SEC=1000 |
|
| 6 |
-TIME_MIN=$((60 * $TIME_SEC)) |
|
| 7 |
- |
|
| 8 |
-# setup_env_vars exports all the necessary environment variables for configuring and |
|
| 9 |
-# starting OS server. |
|
| 10 |
-function setup_env_vars {
|
|
| 11 |
- # set path so OpenShift is available |
|
| 12 |
- GO_OUT="${OS_ROOT}/_output/local/bin/$(os::util::host_platform)"
|
|
| 13 |
- export PATH="${GO_OUT}:${PATH}"
|
|
| 14 |
- |
|
| 15 |
- export ETCD_PORT="${ETCD_PORT:-4001}"
|
|
| 16 |
- export ETCD_PEER_PORT="${ETCD_PEER_PORT:-7001}"
|
|
| 17 |
- export API_BIND_HOST="${API_BIND_HOST:-$(openshift start --print-ip)}"
|
|
| 18 |
- export API_HOST="${API_HOST:-${API_BIND_HOST}}"
|
|
| 19 |
- export API_PORT="${API_PORT:-8443}"
|
|
| 20 |
- export LOG_DIR="${LOG_DIR:-${BASETMPDIR}/logs}"
|
|
| 21 |
- export ETCD_DATA_DIR="${BASETMPDIR}/etcd"
|
|
| 22 |
- export VOLUME_DIR="${BASETMPDIR}/volumes"
|
|
| 23 |
- export FAKE_HOME_DIR="${BASETMPDIR}/openshift.local.home"
|
|
| 24 |
- export API_SCHEME="${API_SCHEME:-https}"
|
|
| 25 |
- export MASTER_ADDR="${API_SCHEME}://${API_HOST}:${API_PORT}"
|
|
| 26 |
- export PUBLIC_MASTER_HOST="${PUBLIC_MASTER_HOST:-${API_HOST}}"
|
|
| 27 |
- export KUBELET_SCHEME="${KUBELET_SCHEME:-https}"
|
|
| 28 |
- export KUBELET_BIND_HOST="${KUBELET_BIND_HOST:-$(openshift start --print-ip)}"
|
|
| 29 |
- export KUBELET_HOST="${KUBELET_HOST:-${KUBELET_BIND_HOST}}"
|
|
| 30 |
- export KUBELET_PORT="${KUBELET_PORT:-10250}"
|
|
| 31 |
- export SERVER_CONFIG_DIR="${BASETMPDIR}/openshift.local.config"
|
|
| 32 |
- export MASTER_CONFIG_DIR="${SERVER_CONFIG_DIR}/master"
|
|
| 33 |
- export NODE_CONFIG_DIR="${SERVER_CONFIG_DIR}/node-${KUBELET_HOST}"
|
|
| 34 |
- export ARTIFACT_DIR="${ARTIFACT_DIR:-${BASETMPDIR}/artifacts}"
|
|
| 35 |
- if [ -z ${SUDO+x} ]; then
|
|
| 36 |
- export SUDO="${SUDO:-1}"
|
|
| 37 |
- fi |
|
| 38 |
- |
|
| 39 |
- # Use either the latest release built images, or latest. |
|
| 40 |
- if [[ -z "${USE_IMAGES-}" ]]; then
|
|
| 41 |
- IMAGES='openshift/origin-${component}:latest'
|
|
| 42 |
- export TAG=latest |
|
| 43 |
- export USE_IMAGES=${IMAGES}
|
|
| 44 |
- if [[ -e "${OS_ROOT}/_output/local/releases/.commit" ]]; then
|
|
| 45 |
- COMMIT="$(cat "${OS_ROOT}/_output/local/releases/.commit")"
|
|
| 46 |
- IMAGES="openshift/origin-\${component}:${COMMIT}"
|
|
| 47 |
- export TAG=${COMMIT}
|
|
| 48 |
- export USE_IMAGES=${IMAGES}
|
|
| 49 |
- fi |
|
| 50 |
- fi |
|
| 51 |
- |
|
| 52 |
- if [[ "${API_SCHEME}" == "https" ]]; then
|
|
| 53 |
- export CURL_CA_BUNDLE="${MASTER_CONFIG_DIR}/ca.crt"
|
|
| 54 |
- export CURL_CERT="${MASTER_CONFIG_DIR}/admin.crt"
|
|
| 55 |
- export CURL_KEY="${MASTER_CONFIG_DIR}/admin.key"
|
|
| 56 |
- fi |
|
| 57 |
- |
|
| 58 |
- # change the location of $HOME so no one does anything naughty |
|
| 59 |
- export HOME="${FAKE_HOME_DIR}"
|
|
| 60 |
-} |
|
| 61 |
- |
|
| 62 |
-# configure_and_start_os will create and write OS master certificates, node config, |
|
| 63 |
-# OS config. |
|
| 5 |
+# configure_os_server will create and write OS master certificates, node configurations, and OpenShift configurations. |
|
| 6 |
+# It is recommended to run the following environment setup functions before configuring the OpenShift server: |
|
| 7 |
+# - os::util::environment::setup_all_server_vars |
|
| 8 |
+# - os::util::environment::use_sudo -- if your script should be using root privileges |
|
| 9 |
+# |
|
| 10 |
+# Globals: |
|
| 11 |
+# - ALL_IP_ADDRESSES |
|
| 12 |
+# - PUBLIC_MASTER_HOST |
|
| 13 |
+# - MASTER_CONFIG_DIR |
|
| 14 |
+# - MASTER_ADDR |
|
| 15 |
+# - API_SCHEME |
|
| 16 |
+# - PUBLIC_MASTER_HOST |
|
| 17 |
+# - API_PORT |
|
| 18 |
+# - KUBELET_SCHEME |
|
| 19 |
+# - KUBELET_BIND_HOST |
|
| 20 |
+# - KUBELET_PORT |
|
| 21 |
+# - NODE_CONFIG_DIR |
|
| 22 |
+# - KUBELET_HOST |
|
| 23 |
+# - API_BIND_HOST |
|
| 24 |
+# - VOLUME_DIR |
|
| 25 |
+# - ETCD_DATA_DIR |
|
| 26 |
+# - USE_IMAGES |
|
| 27 |
+# - USE_SUDO |
|
| 28 |
+# Arguments: |
|
| 29 |
+# None |
|
| 30 |
+# Returns: |
|
| 31 |
+# - export ADMIN_KUBECONFIG |
|
| 32 |
+# - export CLUSTER_ADMIN_CONTEXT |
|
| 64 | 33 |
function configure_os_server {
|
| 65 | 34 |
# find the same IP that openshift start will bind to. This allows access from pods that have to talk back to master |
| 66 | 35 |
if [[ -z "${ALL_IP_ADDRESSES-}" ]]; then
|
| ... | ... |
@@ -122,16 +91,37 @@ function configure_os_server {
|
| 122 | 122 |
# Make oc use ${MASTER_CONFIG_DIR}/admin.kubeconfig, and ignore anything in the running user's $HOME dir
|
| 123 | 123 |
export ADMIN_KUBECONFIG="${MASTER_CONFIG_DIR}/admin.kubeconfig"
|
| 124 | 124 |
export CLUSTER_ADMIN_CONTEXT=$(oc config view --config=${ADMIN_KUBECONFIG} --flatten -o template --template='{{index . "current-context"}}')
|
| 125 |
- local sudo="${SUDO:+sudo}"
|
|
| 125 |
+ local sudo="${USE_SUDO:+sudo}"
|
|
| 126 | 126 |
${sudo} chmod -R a+rwX "${ADMIN_KUBECONFIG}"
|
| 127 | 127 |
echo "[INFO] To debug: export KUBECONFIG=$ADMIN_KUBECONFIG" |
| 128 | 128 |
} |
| 129 | 129 |
|
| 130 | 130 |
|
| 131 |
-# start_os_server starts the OS server, exports the PID of the OS server |
|
| 132 |
-# and waits until OS server endpoints are available |
|
| 131 |
+# start_os_server starts the OpenShift server, exports the PID of the OpenShift server and waits until openshift server endpoints are available |
|
| 132 |
+# It is advised to use this function after a successful run of 'configure_os_server' |
|
| 133 |
+# |
|
| 134 |
+# Globals: |
|
| 135 |
+# - USE_SUDO |
|
| 136 |
+# - LOG_DIR |
|
| 137 |
+# - ARTIFACT_DIR |
|
| 138 |
+# - VOLUME_DIR |
|
| 139 |
+# - SERVER_CONFIG_DIR |
|
| 140 |
+# - USE_IMAGES |
|
| 141 |
+# - MASTER_ADDR |
|
| 142 |
+# - MASTER_CONFIG_DIR |
|
| 143 |
+# - NODE_CONFIG_DIR |
|
| 144 |
+# - API_SCHEME |
|
| 145 |
+# - API_HOST |
|
| 146 |
+# - API_PORT |
|
| 147 |
+# - KUBELET_SCHEME |
|
| 148 |
+# - KUBELET_HOST |
|
| 149 |
+# - KUBELET_PORT |
|
| 150 |
+# Arguments: |
|
| 151 |
+# None |
|
| 152 |
+# Returns: |
|
| 153 |
+# - export OS_PID |
|
| 133 | 154 |
function start_os_server {
|
| 134 |
- local sudo="${SUDO:+sudo}"
|
|
| 155 |
+ local sudo="${USE_SUDO:+sudo}"
|
|
| 135 | 156 |
|
| 136 | 157 |
echo "[INFO] `openshift version`" |
| 137 | 158 |
echo "[INFO] Server logs will be at: ${LOG_DIR}/openshift.log"
|
| ... | ... |
@@ -165,10 +155,26 @@ function start_os_server {
|
| 165 | 165 |
date |
| 166 | 166 |
} |
| 167 | 167 |
|
| 168 |
-# start_os_master starts the OS server, exports the PID of the OS server |
|
| 169 |
-# and waits until OS server endpoints are available |
|
| 168 |
+# start_os_master starts the OpenShift master, exports the PID of the OpenShift master and waits until OpenShift master endpoints are available |
|
| 169 |
+# It is advised to use this function after a successful run of 'configure_os_server' |
|
| 170 |
+# |
|
| 171 |
+# Globals: |
|
| 172 |
+# - USE_SUDO |
|
| 173 |
+# - LOG_DIR |
|
| 174 |
+# - ARTIFACT_DIR |
|
| 175 |
+# - SERVER_CONFIG_DIR |
|
| 176 |
+# - USE_IMAGES |
|
| 177 |
+# - MASTER_ADDR |
|
| 178 |
+# - MASTER_CONFIG_DIR |
|
| 179 |
+# - API_SCHEME |
|
| 180 |
+# - API_HOST |
|
| 181 |
+# - API_PORT |
|
| 182 |
+# Arguments: |
|
| 183 |
+# None |
|
| 184 |
+# Returns: |
|
| 185 |
+# - export OS_PID |
|
| 170 | 186 |
function start_os_master {
|
| 171 |
- local sudo="${SUDO:+sudo}"
|
|
| 187 |
+ local sudo="${USE_SUDO:+sudo}"
|
|
| 172 | 188 |
|
| 173 | 189 |
echo "[INFO] `openshift version`" |
| 174 | 190 |
echo "[INFO] Server logs will be at: ${LOG_DIR}/openshift.log"
|
| ... | ... |
@@ -434,7 +440,7 @@ function validate_response {
|
| 434 | 434 |
# |
| 435 | 435 |
# $1 expression for which the mounts should be checked |
| 436 | 436 |
reset_tmp_dir() {
|
| 437 |
- local sudo="${SUDO:+sudo}"
|
|
| 437 |
+ local sudo="${USE_SUDO:+sudo}"
|
|
| 438 | 438 |
|
| 439 | 439 |
set +e |
| 440 | 440 |
${sudo} rm -rf ${BASETMPDIR} &>/dev/null
|
| ... | ... |
@@ -452,7 +458,7 @@ reset_tmp_dir() {
|
| 452 | 452 |
# all processes created by the test script. |
| 453 | 453 |
function kill_all_processes() |
| 454 | 454 |
{
|
| 455 |
- local sudo="${SUDO:+sudo}"
|
|
| 455 |
+ local sudo="${USE_SUDO:+sudo}"
|
|
| 456 | 456 |
|
| 457 | 457 |
pids=($(jobs -pr)) |
| 458 | 458 |
for i in ${pids[@]-}; do
|
| ... | ... |
@@ -493,12 +499,12 @@ function delete_empty_logs() {
|
| 493 | 493 |
|
| 494 | 494 |
# truncate_large_logs truncates large logs so we only download the last 20MB |
| 495 | 495 |
function truncate_large_logs() {
|
| 496 |
- # Clean up large log files so they don't end up on jenkins |
|
| 496 |
+ # Clean up large log files so they don't end up on jenkins |
|
| 497 | 497 |
local large_files=$(find "${ARTIFACT_DIR}" "${LOG_DIR}" -type f -name '*.log' \( -size +20M \))
|
| 498 |
- for file in "${large_files}"; do
|
|
| 498 |
+ for file in ${large_files}; do
|
|
| 499 | 499 |
cp "${file}" "${file}.tmp"
|
| 500 | 500 |
echo "LOGFILE TOO LONG, PREVIOUS BYTES TRUNCATED. LAST 20M BYTES OF LOGFILE:" > "${file}"
|
| 501 |
- tail -c 20M "${file}.tmp" > "${file}"
|
|
| 501 |
+ tail -c 20M "${file}.tmp" >> "${file}"
|
|
| 502 | 502 |
rm "${file}.tmp"
|
| 503 | 503 |
done |
| 504 | 504 |
} |
| ... | ... |
@@ -555,8 +561,8 @@ function cleanup_openshift {
|
| 555 | 555 |
function create_gitconfig {
|
| 556 | 556 |
USERNAME=sample-user |
| 557 | 557 |
PASSWORD=password |
| 558 |
- TMPDIR="${TMPDIR:-"/tmp"}"
|
|
| 559 |
- GITCONFIG_DIR=$(mktemp -d ${TMPDIR}/test-gitconfig.XXXX)
|
|
| 558 |
+ BASETMPDIR="${BASETMPDIR:-"/tmp"}"
|
|
| 559 |
+ GITCONFIG_DIR=$(mktemp -d ${BASETMPDIR}/test-gitconfig.XXXX)
|
|
| 560 | 560 |
touch ${GITCONFIG_DIR}/.gitconfig
|
| 561 | 561 |
git config --file ${GITCONFIG_DIR}/.gitconfig user.name ${USERNAME}
|
| 562 | 562 |
git config --file ${GITCONFIG_DIR}/.gitconfig user.token ${PASSWORD}
|
| ... | ... |
@@ -564,8 +570,8 @@ function create_gitconfig {
|
| 564 | 564 |
} |
| 565 | 565 |
|
| 566 | 566 |
function create_valid_file {
|
| 567 |
- TMPDIR="${TMPDIR:-"/tmp"}"
|
|
| 568 |
- FILE_DIR=$(mktemp -d ${TMPDIR}/test-file.XXXX)
|
|
| 567 |
+ BASETMPDIR="${BASETMPDIR:-"/tmp"}"
|
|
| 568 |
+ FILE_DIR=$(mktemp -d ${BASETMPDIR}/test-file.XXXX)
|
|
| 569 | 569 |
touch ${FILE_DIR}/${1}
|
| 570 | 570 |
echo ${FILE_DIR}/${1}
|
| 571 | 571 |
} |
| ... | ... |
@@ -11,6 +11,9 @@ OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
| 11 | 11 |
source "${OS_ROOT}/hack/util.sh"
|
| 12 | 12 |
os::log::install_errexit |
| 13 | 13 |
|
| 14 |
+source "${OS_ROOT}/hack/lib/util/environment.sh"
|
|
| 15 |
+os::util::environment::setup_time_vars |
|
| 16 |
+ |
|
| 14 | 17 |
ROUTER_TESTS_ENABLED="${ROUTER_TESTS_ENABLED:-true}"
|
| 15 | 18 |
TEST_ASSETS="${TEST_ASSETS:-false}"
|
| 16 | 19 |
|
| ... | ... |
@@ -334,7 +337,6 @@ oc exec -p ${registry_pod} du /registry > ${LOG_DIR}/prune-images.after.txt
|
| 334 | 334 |
# make sure there were changes to the registry's storage |
| 335 | 335 |
[ -n "$(diff ${LOG_DIR}/prune-images.before.txt ${LOG_DIR}/prune-images.after.txt)" ]
|
| 336 | 336 |
|
| 337 |
- |
|
| 338 | 337 |
# UI e2e tests can be found in assets/test/e2e |
| 339 | 338 |
if [[ "$TEST_ASSETS" == "true" ]]; then |
| 340 | 339 |
|
| ... | ... |
@@ -90,12 +90,12 @@ package is not included by `test/extended`. |
| 90 | 90 |
Bash helpers for creating new test group runner |
| 91 | 91 |
----------------------------------------------- |
| 92 | 92 |
|
| 93 |
-Common functions for extended tests are located in `./hack/util.sh`. |
|
| 93 |
+Common functions for extended tests are located in `./hack/util.sh`. Environment setup scripts are located in `hack/lib/util/evironment.sh`. |
|
| 94 | 94 |
|
| 95 | 95 |
* `ginkgo_check_extended()` verify if the Ginkgo binary is installed. |
| 96 | 96 |
* `compile_extended()` perform the compilation of the Go tests into a test binary. |
| 97 | 97 |
* `test_privileges()` verify if you have permissions to start OpenShift server. |
| 98 |
-* `setup_env_vars()` setup all required environment variables related to OpenShift server. |
|
| 98 |
+* `os::util::environment::setup_all_server_vars()` setup all required environment variables related to OpenShift server. |
|
| 99 | 99 |
* `configure_os_server()` generates all configuration files for OpenShift server. |
| 100 | 100 |
* `start_os_server()` starts the OpenShift master and node. |
| 101 | 101 |
* `install_router_extended()` installs the OpenShift router service. |
| ... | ... |
@@ -1,4 +1,4 @@ |
| 1 |
-#!/bin/bash |
|
| 1 |
+ #!/bin/bash |
|
| 2 | 2 |
# |
| 3 | 3 |
# This scripts starts the OpenShift server with a default configuration. |
| 4 | 4 |
# No registry or router is setup. |
| ... | ... |
@@ -14,15 +14,14 @@ source "${OS_ROOT}/hack/util.sh"
|
| 14 | 14 |
source "${OS_ROOT}/hack/common.sh"
|
| 15 | 15 |
source "${OS_ROOT}/hack/lib/log.sh"
|
| 16 | 16 |
os::log::install_errexit |
| 17 |
+ |
|
| 18 |
+source "${OS_ROOT}/hack/lib/util/environment.sh"
|
|
| 19 |
+os::util::environment::setup_time_vars |
|
| 20 |
+ |
|
| 17 | 21 |
cd "${OS_ROOT}"
|
| 18 | 22 |
|
| 19 | 23 |
os::build::setup_env |
| 20 | 24 |
|
| 21 |
-export TMPDIR="${TMPDIR:-"/tmp"}"
|
|
| 22 |
-export BASETMPDIR="${TMPDIR}/openshift-extended-tests/authentication"
|
|
| 23 |
-export EXTENDED_TEST_PATH="${OS_ROOT}/test/extended"
|
|
| 24 |
-export KUBE_REPO_ROOT="${OS_ROOT}/../../../k8s.io/kubernetes"
|
|
| 25 |
- |
|
| 26 | 25 |
function cleanup() |
| 27 | 26 |
{
|
| 28 | 27 |
out=$? |
| ... | ... |
@@ -37,7 +36,8 @@ trap "cleanup" EXIT |
| 37 | 37 |
|
| 38 | 38 |
echo "[INFO] Starting server" |
| 39 | 39 |
|
| 40 |
-setup_env_vars |
|
| 40 |
+os::util::environment::setup_all_server_vars "test-extended/cmd/" |
|
| 41 |
+os::util::environment::use_sudo |
|
| 41 | 42 |
reset_tmp_dir |
| 42 | 43 |
|
| 43 | 44 |
os::log::start_system_logger |
| ... | ... |
@@ -17,6 +17,10 @@ source "${OS_ROOT}/hack/util.sh"
|
| 17 | 17 |
source "${OS_ROOT}/hack/common.sh"
|
| 18 | 18 |
source "${OS_ROOT}/hack/lib/log.sh"
|
| 19 | 19 |
os::log::install_errexit |
| 20 |
+ |
|
| 21 |
+source "${OS_ROOT}/hack/lib/util/environment.sh"
|
|
| 22 |
+os::util::environment::setup_time_vars |
|
| 23 |
+ |
|
| 20 | 24 |
cd "${OS_ROOT}"
|
| 21 | 25 |
|
| 22 | 26 |
# ensure_ginkgo_or_die |
| ... | ... |
@@ -26,8 +30,6 @@ os::build::setup_env |
| 26 | 26 |
# go test -c ./test/extended -o ${OS_OUTPUT_BINPATH}/extended.test
|
| 27 | 27 |
#fi |
| 28 | 28 |
|
| 29 |
-export TMPDIR="${TMPDIR:-"/tmp"}"
|
|
| 30 |
-export BASETMPDIR="${TMPDIR}/openshift-extended-tests/core"
|
|
| 31 | 29 |
export EXTENDED_TEST_PATH="${OS_ROOT}/test/extended"
|
| 32 | 30 |
|
| 33 | 31 |
# TODO: check out the version of Kube we need so that we have access to sample content - in the future, |
| ... | ... |
@@ -105,7 +107,8 @@ if [[ -z ${TEST_ONLY+x} ]]; then
|
| 105 | 105 |
trap "cleanup" EXIT |
| 106 | 106 |
echo "[INFO] Starting server" |
| 107 | 107 |
|
| 108 |
- setup_env_vars |
|
| 108 |
+ os::util::environment::setup_all_server_vars "test-extended/core" |
|
| 109 |
+ os::util::environment::use_sudo |
|
| 109 | 110 |
reset_tmp_dir |
| 110 | 111 |
|
| 111 | 112 |
os::log::start_system_logger |
| ... | ... |
@@ -13,17 +13,13 @@ source "${OS_ROOT}/hack/util.sh"
|
| 13 | 13 |
source "${OS_ROOT}/hack/common.sh"
|
| 14 | 14 |
source "${OS_ROOT}/hack/lib/log.sh"
|
| 15 | 15 |
os::log::install_errexit |
| 16 |
-cd "${OS_ROOT}"
|
|
| 17 |
- |
|
| 18 |
-os::build::setup_env |
|
| 19 | 16 |
|
| 20 |
-export TMPDIR="${TMPDIR:-"/tmp"}"
|
|
| 21 |
-export BASETMPDIR="${TMPDIR}/openshift-extended-tests/authentication"
|
|
| 22 |
-export EXTENDED_TEST_PATH="${OS_ROOT}/test/extended"
|
|
| 23 |
-export KUBE_REPO_ROOT="${OS_ROOT}/../../../k8s.io/kubernetes"
|
|
| 17 |
+source "${OS_ROOT}/hack/lib/util/environment.sh"
|
|
| 18 |
+os::util::environment::setup_time_vars |
|
| 24 | 19 |
|
| 25 |
-function join { local IFS="$1"; shift; echo "$*"; }
|
|
| 20 |
+cd "${OS_ROOT}"
|
|
| 26 | 21 |
|
| 22 |
+os::build::setup_env |
|
| 27 | 23 |
|
| 28 | 24 |
function cleanup() |
| 29 | 25 |
{
|
| ... | ... |
@@ -39,7 +35,8 @@ trap "cleanup" EXIT |
| 39 | 39 |
echo "[INFO] Starting server" |
| 40 | 40 |
|
| 41 | 41 |
ensure_iptables_or_die |
| 42 |
-setup_env_vars |
|
| 42 |
+os::util::environment::setup_all_server_vars "test-extended/ldap_groups/" |
|
| 43 |
+os::util::environment::use_sudo |
|
| 43 | 44 |
reset_tmp_dir |
| 44 | 45 |
|
| 45 | 46 |
os::log::start_system_logger |
| ... | ... |
@@ -19,6 +19,7 @@ OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
| 19 | 19 |
source "${OS_ROOT}/hack/util.sh"
|
| 20 | 20 |
source "${OS_ROOT}/hack/common.sh"
|
| 21 | 21 |
source "${OS_ROOT}/hack/lib/log.sh"
|
| 22 |
+source "${OS_ROOT}/hack/lib/util/environment.sh"
|
|
| 22 | 23 |
os::log::install_errexit |
| 23 | 24 |
|
| 24 | 25 |
# These strings filter the available tests. |
| ... | ... |
@@ -222,9 +223,7 @@ else |
| 222 | 222 |
"${OPENSHIFT_INSTANCE_PREFIX}-node-2"
|
| 223 | 223 |
) |
| 224 | 224 |
|
| 225 |
- export TMPDIR="${TMPDIR:-"/tmp"}"
|
|
| 226 |
- export BASETMPDIR="${TMPDIR}/openshift-extended-tests/networking"
|
|
| 227 |
- setup_env_vars |
|
| 225 |
+ os::util::environment::setup_tmpdir_vars "test-extended/networking" |
|
| 228 | 226 |
reset_tmp_dir |
| 229 | 227 |
|
| 230 | 228 |
os::log::start_system_logger |