Permalink
Browse files

Fix for #82 and #119

  • Loading branch information...
1 parent 0adef77 commit e69cae052eb85a97aef9e953fd649cb42d2296a9 @astiunov astiunov committed May 10, 2016
Showing with 19 additions and 10 deletions.
  1. +9 −10 build_tools/test_frontend.sh
  2. +7 −0 everware/spawner.py
  3. +3 −0 everware/user_wait_handler.py
@@ -34,14 +34,6 @@ if [ -z "$UPLOADDIR" ] ; then
fi
[ -d $UPLOADDIR ] && rm -rf $UPLOADDIR/*
nose2 -v -N $NPROC --start-dir=frontend_tests || FAIL=1
-
-if [ -f $LOG ]; then
- echo ">>> Frontend test hub log:"
- cat $LOG
- echo "<<< Frontend test hub log:"
- docker ps -a
-fi
-
ADDED_CONT=0
docker ps -a -q | sort >new_cont
@@ -55,13 +47,20 @@ if [ $ADDED_CONT -eq 1 ]; then
cat new_cont
fi
+if [ -f $LOG ] && [ $FAIL -eq 1 ]; then
+ echo ">>> Frontend test hub log:"
+ cat $LOG
+ echo "<<< Frontend test hub log:"
+ docker ps -a
+fi
+
rm old_cont new_cont
pkill -f everware-server
pkill -f node
if [ $FAIL -eq 1 ]; then
exit $FAIL
fi
-sleep 15
+sleep 30
# spawn container to substitute in tests
echo "Spawning running container"
@@ -81,7 +80,7 @@ export NOT_REMOVE=1
nose2 -v -N $NPROC --start-dir=frontend_tests || FAIL=1
-if [ -f $LOG ]; then
+if [ -f $LOG ] && [ $FAIL -eq 1 ]; then
echo ">>> Frontend test hub log (not remove containers):"
cat $LOG
echo "<<< Frontend test hub log (not remove containers):"
View
@@ -130,6 +130,7 @@ def __init__(self, **kwargs):
self._is_building = False
self._image_handler = ImageHandler()
self._cur_waiter = None
+ self._is_empty = False
super(CustomDockerSpawner, self).__init__(**kwargs)
@@ -220,6 +221,10 @@ def container_name(self):
def need_remove(self):
return self.user_options.get('need_remove', True)
+ @property
+ def is_empty(self):
+ return self._is_empty
+
@gen.coroutine
def get_container(self):
@@ -341,6 +346,7 @@ def start(self, image=None):
self._user_log = []
self._is_failed = False
self._is_building = True
+ self._is_empty = False
try:
f = self.build_image()
image_name = yield gen.with_timeout(
@@ -386,6 +392,7 @@ def stop(self, now=False):
Consider using pause/unpause when docker-py adds support
"""
+ self._is_empty = True
self.log.info(
"Stopping container %s (id: %s)",
self.container_name, self.container_id[:7])
@@ -25,6 +25,9 @@ def get(self, name, user_path):
is_running = yield current_user.spawner.is_running()
if not current_user.spawn_pending and not is_failed and is_running:
is_done = True
+ if current_user.spawner.is_empty and not is_failed:
+ self.redirect(url_path_join(self.hub.server.base_url, 'home'))
+ return
else:
log_lines = []
if is_log_request:

0 comments on commit e69cae0

Please sign in to comment.