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

[metastore] Convert the partition test to check on the partition page

Instead of looking to a number of records
Romain Rigaux 10 жил өмнө
parent
commit
1d5c2bf

+ 3 - 0
apps/beeswax/src/beeswax/server/hive_server2_lib.py

@@ -935,6 +935,9 @@ class PartitionValueCompatible:
     self.values = [pv[1] for pv in [part.split('=') for part in parts]]
     self.sd = type('Sd', (object,), properties,)
 
+  def __repr__(self):
+    return 'PartitionValueCompatible(spec:%s, values:%s, sd:%s)' % (self.partition_spec, self.values, self.sd)
+
 
 class ExplainCompatible:
 

+ 13 - 5
apps/metastore/src/metastore/tests.py

@@ -175,12 +175,20 @@ class TestMetastoreWithHadoop(BeeswaxSampleProvider):
     assert_true("is not partitioned." in response.content)
 
   def test_describe_partitioned_table_with_limit(self):
-    # Limit to 90
-    finish = BROWSE_PARTITIONED_TABLE_LIMIT.set_for_testing("90")
+    # We have 2 partitions in the test table
+    finish = BROWSE_PARTITIONED_TABLE_LIMIT.set_for_testing("1")
     try:
-      response = self.client.get("/metastore/table/%s/test_partitions" % self.db_name)
-      assert_true("0x%x" % 89 in response.content, response.content)
-      assert_false("0x%x" % 90 in response.content, response.content)
+      response = self.client.get("/metastore/table/%s/test_partitions/partitions" % self.db_name)
+      partition_values_json = json.loads(response.context['partition_values_json'])
+      assert_equal(1, len(partition_values_json))
+    finally:
+      finish()
+
+    finish = BROWSE_PARTITIONED_TABLE_LIMIT.set_for_testing("3")
+    try:
+      response = self.client.get("/metastore/table/%s/test_partitions/partitions" % self.db_name)
+      partition_values_json = json.loads(response.context['partition_values_json'])
+      assert_equal(2, len(partition_values_json))
     finally:
       finish()