瀏覽代碼

[beeswax] Only try to delete database in tests if it exists

Erick Tryzelaar 10 年之前
父節點
當前提交
8a0012eff0
共有 2 個文件被更改,包括 15 次插入10 次删除
  1. 12 10
      apps/beeswax/src/beeswax/test_base.py
  2. 3 0
      apps/beeswax/src/beeswax/tests.py

+ 12 - 10
apps/beeswax/src/beeswax/test_base.py

@@ -350,16 +350,18 @@ class BeeswaxSampleProvider(object):
       db = dbms.get(user, query_server)
 
       for db_name in [cls.db_name, '%s_other' % cls.db_name]:
-        tables = db.get_tables(database=db_name)
-        for table in tables:
-          make_query(client, 'DROP TABLE IF EXISTS `%(db)s`.`%(table)s`' % {'db': db_name, 'table': table}, wait=True)
-        make_query(client, 'DROP VIEW IF EXISTS `%(db)s`.`myview`' % {'db': db_name}, wait=True)
-        make_query(client, 'DROP DATABASE IF EXISTS %(db)s' % {'db': db_name}, wait=True)
-
-      # Check the cleanup
-      databases = db.get_databases()
-      assert_false(cls.db_name in databases)
-      assert_false('%(db)s_other' % {'db': cls.db_name} in databases)
+        databases = db.get_databases()
+
+        if db_name in databases:
+          tables = db.get_tables(database=db_name)
+          for table in tables:
+            make_query(client, 'DROP TABLE IF EXISTS `%(db)s`.`%(table)s`' % {'db': db_name, 'table': table}, wait=True)
+          make_query(client, 'DROP VIEW IF EXISTS `%(db)s`.`myview`' % {'db': db_name}, wait=True)
+          make_query(client, 'DROP DATABASE IF EXISTS %(db)s' % {'db': db_name}, wait=True)
+
+          # Check the cleanup
+          databases = db.get_databases()
+          assert_false(db_name in databases)
 
   @classmethod
   def init_beeswax_db(cls):

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

@@ -1710,6 +1710,9 @@ for x in sys.stdin:
 
 
   def test_get_top_terms(self):
+    if is_live_cluster():
+      raise SkipTest('HUE-2902: Skipping because test is not reentrant')
+
     resp = self.client.get(reverse("beeswax:get_top_terms", kwargs={'database': self.db_name, 'table': 'test', 'column': 'foo'}))
 
     content = json.loads(resp.content)