forked from loren/dcos-commons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·55 lines (47 loc) · 2.22 KB
/
test.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
#!/usr/bin/env bash
# This file contains logic for integration tests which are executed by CI upon pull requests to
# dcos-commons. The script builds the Hello World framework, packages and uploads it, then runs its
# integration tests against a newly-launched cluster.
# Exit immediately on errors -- the helper scripts all emit github statuses internally
set -e
REPO_ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $REPO_ROOT_DIR
# Path to hello world scheduler:
HELLOWORLD_DIR=${REPO_ROOT_DIR}/frameworks/helloworld
# Build/upload hello world scheduler artifact if one is not directly provided:
if [ -z "$STUB_UNIVERSE_URL" ]; then
# Build/upload hello world scheduler:
UNIVERSE_URL_PATH=${REPO_ROOT_DIR}/helloworld-universe-url
UNIVERSE_URL_PATH=$UNIVERSE_URL_PATH ${HELLOWORLD_DIR}/build.sh aws
if [ ! -f "${UNIVERSE_URL_PATH}" ]; then
echo "Missing universe URL file: $UNIVERSE_URL_PATH"
exit 1
fi
export STUB_UNIVERSE_URL=$(cat $UNIVERSE_URL_PATH)
rm -f $UNIVERSE_URL_PATH
echo "Built/uploaded stub universe: $STUB_UNIVERSE_URL"
else
echo "Using provided STUB_UNIVERSE_URL: $STUB_UNIVERSE_URL"
fi
# Get a CCM cluster if not already configured (see available settings in dcos-commons/tools/README.md):
if [ -z "$CLUSTER_URL" ]; then
echo "CLUSTER_URL is empty/unset, launching new cluster."
export CCM_AGENTS=5
CLUSTER_INFO=$(${REPO_ROOT_DIR}/tools/launch_ccm_cluster.py)
echo "Launched cluster: ${CLUSTER_INFO}"
export CLUSTER_URL=$(echo "${CLUSTER_INFO}" | jq .url)
export CLUSTER_ID=$(echo "${CLUSTER_INFO}" | jq .id)
export CLUSTER_AUTH_TOKEN=$(echo "${CLUSTER_INFO}" | jq .auth_token)
else
echo "Using provided CLUSTER_URL as cluster: $CLUSTER_URL"
fi
# Run shakedown tests in helloworld scheduler directory:
${REPO_ROOT_DIR}/tools/run_tests.py \
shakedown \
${HELLOWORLD_DIR}/integration/tests/ \
${HELLOWORLD_DIR}/integration/requirements.txt
# Tests succeeded. Out of courtesy, trigger a teardown of the cluster if we created it ourselves.
# Don't wait for the cluster to complete teardown.
if [ -n "${CLUSTER_ID}" ]; then
${REPO_ROOT_DIR}/tools/launch_ccm_cluster.py trigger-stop ${CLUSTER_ID}
fi