Эх сурвалжийг харах

HUE-958 [fb,oozie] Fix flakey tests

- filebrowser.views_test.test_listdir: needed to remove home directory prior to listdir request
- liboozie.oozie_api_test.TestMiniOozie.test_ooize_status: syntacticaly error
abec 13 жил өмнө
parent
commit
2803e692ee

+ 6 - 4
apps/filebrowser/src/filebrowser/views_test.py

@@ -30,7 +30,7 @@ import urlparse
 
 from django.utils.encoding import smart_str
 from nose.plugins.attrib import attr
-from nose.tools import assert_true, assert_false, assert_equal, assert_raises, assert_not_equal
+from nose.tools import assert_true, assert_false, assert_equal, assert_not_equal
 
 from desktop.lib.django_test_util import make_logged_in_client
 from desktop.lib.test_utils import grant_access
@@ -366,6 +366,10 @@ def test_listdir():
     c = make_logged_in_client(cluster.superuser)
     cluster.fs.setuser(cluster.superuser)
 
+    # Delete user's home if there's already something there
+    if cluster.fs.isdir("/user/test"):
+      cluster.fs.rmtree("/user/test")
+
     # These paths contain non-ascii characters. Your editor will need the
     # corresponding font library to display them correctly.
     #
@@ -401,9 +405,7 @@ def test_listdir():
       # We are actually reading a directory
       assert_equal('..', resp.context['files'][0]['name'], "'%s' should be a directory" % (path,))
 
-    # Delete user's home if there's already something there
-    if cluster.fs.isdir("/user/test"):
-      cluster.fs.rmtree("/user/test")
+    # Since we deleted the home directory... home_directory context should be false.
     assert_false(response.context['home_directory'])
 
     # test's home directory now exists. Should be returned.

+ 1 - 1
desktop/libs/liboozie/src/liboozie/oozie_api_test.py

@@ -180,4 +180,4 @@ class TestMiniOozie(OozieServerProvider):
   def test_oozie_status(self):
     assert_equal(get_oozie().get_oozie_status()['systemMode'], 'NORMAL')
 
-    assert_true(self.cluster.fs.exists('/user/%(user)s/share/lib') % {'user': getpass.getuser()})
+    assert_true(self.cluster.fs.exists('/user/%(user)s/share/lib' % {'user': getpass.getuser()}))