You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2013/08/22 05:22:38 UTC
git commit: Fixed the Balloon Framework Test.
Updated Branches:
refs/heads/master 604fbdac0 -> aa6f2ca2e
Fixed the Balloon Framework Test.
Stop exporting variables that begin with MESOS_ into the mesos
environment. The mesos-master and mesos-slave binaries will not start
if there are unrecognized variables that begin with MESOS_ in the
environment.
Set the LD_LIBRARY_PATH so that the balloon binaries built with
libtool will be able to find all of their pieces and execute properly
without needing to be installed.
Cleanup the cleanup code so we don't unmount a cgroup hierarchy unless
we have fully cleaned it up. This is necessary to prevent a problem
where the hierarchy can never be mounted again.
Update the command line options to mesos-master to pass the hierarchy
and the mesos root directory in that hierarchy.
Clearly report when the balloon hierarchy returns with an unexpected
return code in order to indicate whether the test failed because of a
problem in the baloon framework or within mesos.
From: Eric Biederman <eb...@xmission.com>
Review: https://reviews.apache.org/r/13034
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/aa6f2ca2
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/aa6f2ca2
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/aa6f2ca2
Branch: refs/heads/master
Commit: aa6f2ca2e76c6fddcd28ae3762145b828e19736f
Parents: 604fbda
Author: Benjamin Mahler <bm...@twitter.com>
Authored: Wed Aug 21 19:37:17 2013 -0700
Committer: Benjamin Mahler <bm...@twitter.com>
Committed: Wed Aug 21 20:01:54 2013 -0700
----------------------------------------------------------------------
src/tests/balloon_framework_test.sh | 41 +++++++++++++++++++++++++-------
1 file changed, 33 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/aa6f2ca2/src/tests/balloon_framework_test.sh
----------------------------------------------------------------------
diff --git a/src/tests/balloon_framework_test.sh b/src/tests/balloon_framework_test.sh
index 4309f40..8e99456 100755
--- a/src/tests/balloon_framework_test.sh
+++ b/src/tests/balloon_framework_test.sh
@@ -7,17 +7,19 @@ source ${MESOS_SOURCE_DIR}/support/colors.sh
source ${MESOS_SOURCE_DIR}/support/atexit.sh
# TODO(benh): Look for an existing hierarchy first.
-HIERARCHY=/cgroup
+TEST_CGROUP_HIERARCHY=/tmp/mesos_test_cgroup
+TEST_CGROUP_ROOT=mesos_test
# Check if the hierarchy exists. If it doesn't, we want to make sure we
# remove it, since we will create it.
unmount=false
-if [[ ! -d ${HIERARCHY} ]]; then
+if [[ ! -d ${TEST_CGROUP_HIERARCHY} ]]; then
unmount=true
fi
MASTER_PID=
SLAVE_PID=
+SLAVE_WORK_DIR=
# This function ensures that we first kill the slave (if present) and
# then cleanup the cgroups. This is necessary because a running slave
@@ -37,19 +39,35 @@ function cleanup() {
fi
# Make sure we cleanup any cgroups we created on exiting.
- find ${HIERARCHY}/mesos/* -depth -type d | xargs -r rmdir
+ find ${TEST_CGROUP_HIERARCHY}/${TEST_CGROUP_ROOT} -mindepth 1 -depth -type d | xargs -r rmdir
# Make sure we cleanup the hierarchy, if we created it.
# NOTE: We do a sleep here, to ensure the hierarchy is not busy.
if ${unmount}; then
- rmdir ${HIERARCHY}/mesos; sleep 1; umount ${HIERARCHY}; rmdir ${HIERARCHY}
+ rmdir ${TEST_CGROUP_HIERARCHY}/${TEST_CGROUP_ROOT} && sleep 1 && umount ${TEST_CGROUP_HIERARCHY} && rmdir ${TEST_CGROUP_HIERARCHY}
+ fi
+
+ if [[ -d "${SLAVE_WORK_DIR}" ]]; then
+ rm -rf ${SLAVE_WORK_DIR};
fi
}
atexit cleanup
+export LD_LIBRARY_PATH=${MESOS_BUILD_DIR}/src/.libs
+MASTER=${MESOS_BUILD_DIR}/src/mesos-master
+SLAVE=${MESOS_BUILD_DIR}/src/mesos-slave
+BALLOON_FRAMEWORK=${MESOS_BUILD_DIR}/src/balloon-framework
+
+# The mesos binaries expect MESOS_ prefixed environment variables
+# to correspond to flags, so we unset these here.
+unset MESOS_BUILD_DIR
+unset MESOS_SOURCE_DIR
+unset MESOS_LAUNCHER_DIR
+unset MESOS_VERBOSE
+
# Launch master.
-${MESOS_BUILD_DIR}/src/mesos-master --port=5432 &
+${MASTER} --port=5432 &
MASTER_PID=${!}
echo "${GREEN}Launched master at ${MASTER_PID}${NORMAL}"
sleep 2
@@ -64,10 +82,14 @@ fi
# Launch slave.
-${MESOS_BUILD_DIR}/src/mesos-slave \
+SLAVE_WORK_DIR=`mktemp -d`
+
+${SLAVE} \
+ --work_dir=${SLAVE_WORK_DIR} \
--master=localhost:5432 \
--isolation=cgroups \
- --cgroups_hierarchy_root=${HIERARCHY} \
+ --cgroups_hierarchy=${TEST_CGROUP_HIERARCHY} \
+ --cgroups_root=${TEST_CGROUP_ROOT} \
--resources="cpus:1;mem:96" &
SLAVE_PID=${!}
echo "${GREEN}Launched slave at ${SLAVE_PID}${NORMAL}"
@@ -82,11 +104,12 @@ if [[ ${STATUS} -ne 0 ]]; then
fi
# The main event!
-${MESOS_BUILD_DIR}/src/balloon-framework localhost:5432 1024
+${BALLOON_FRAMEWORK} localhost:5432 1024
STATUS=${?}
# Make sure the balloon framework "failed".
if [[ ! ${STATUS} -eq 1 ]]; then
+ echo "${RED} Balloon framework returned ${STATUS} not 1${NORMAL}"
exit 1
fi
@@ -97,3 +120,5 @@ if [[ ${STATUS} -ne 0 ]]; then
echo "${RED}Slave crashed; failing test${NORMAL}"
exit 2
fi
+
+exit 0