Browse Source

Fix tests for pig and beeswax

Abraham Elmahrek 12 years ago
parent
commit
3c281a9
2 changed files with 5 additions and 3 deletions
  1. 2 0
      apps/beeswax/src/beeswax/tests.py
  2. 3 3
      apps/pig/src/pig/tests.py

+ 2 - 0
apps/beeswax/src/beeswax/tests.py

@@ -1308,6 +1308,7 @@ def test_hive_site():
     assert_equal(beeswax.hive_site.get_conf()['hive.metastore.warehouse.dir'], u'/abc')
     assert_equal(kerberos_principal, 'test/test.com@TEST.COM')
   finally:
+    beeswax.hive_site.reset()
     if saved is not None:
       beeswax.conf.BEESWAX_HIVE_CONF_DIR = saved
     shutil.rmtree(tmpdir)
@@ -1416,6 +1417,7 @@ def test_hive_site_multi_metastore_uris():
     assert_equal(host, 'darkside-12345')
     assert_equal(port, 9998)
   finally:
+    beeswax.hive_site.reset()
     if saved is not None:
       beeswax.conf.BEESWAX_HIVE_CONF_DIR = saved
     shutil.rmtree(tmpdir)

+ 3 - 3
apps/pig/src/pig/tests.py

@@ -65,7 +65,7 @@ class TestWithHadoop(OozieBase):
     grant_access("test", "test", "pig")
     self.c.post(reverse('pig:install_examples'))
 
-  def wait_until_completion(self, pig_script_id, timeout=300.0, step=5):
+  def wait_until_completion(self, pig_script_id, timeout=300.0, step=5, expected_status='SUCCEEDED'):
     script = PigScript.objects.get(id=pig_script_id)
     job_id = script.dict['job_id']
 
@@ -81,7 +81,7 @@ class TestWithHadoop(OozieBase):
 
     logs = OozieServerProvider.oozie.get_job_log(job_id)
 
-    if response['workflow']['status'] != 'SUCCEEDED':
+    if response['workflow']['status'] != expected_status:
       msg = "[%d] %s took more than %d to complete or %s: %s" % (time.time(), job_id, timeout, response['workflow']['status'], logs)
       raise Exception(msg)
 
@@ -123,4 +123,4 @@ class TestWithHadoop(OozieBase):
     assert_true(script.dict['job_id'], script.dict)
 
     stop_response = self.c.post(reverse('pig:stop'), data={'id': script.id}, follow=True)
-    assert_equal('KILLED', json.loads(stop_response.content)['workflow']['status'])
+    self.wait_until_completion(json.loads(submit_response.content)['id'], expected_status='KILLED')