superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maximebeauche...@apache.org
Subject [incubator-superset] 01/01: Fix test
Date Wed, 26 Jul 2017 22:32:14 GMT
This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch hive_support
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git

commit 0b0f9c138d3e10d95d03ef1b6b70469bfba3a65b
Author: Maxime Beauchemin <maximebeauchemin@gmail.com>
AuthorDate: Wed Jul 26 21:33:34 2017 +0000

    Fix test
---
 .../javascripts/SqlLab/components/ResultSet.jsx    |  5 ++-
 tests/db_engine_specs_test.py                      | 40 ++++++++++++----------
 tests/sqllab_tests.py                              |  4 +--
 3 files changed, 27 insertions(+), 22 deletions(-)

diff --git a/superset/assets/javascripts/SqlLab/components/ResultSet.jsx b/superset/assets/javascripts/SqlLab/components/ResultSet.jsx
index c04c3c9..f306050 100644
--- a/superset/assets/javascripts/SqlLab/components/ResultSet.jsx
+++ b/superset/assets/javascripts/SqlLab/components/ResultSet.jsx
@@ -166,7 +166,10 @@ export default class ResultSet extends React.PureComponent {
       }
       if (query.trackingUrl) {
         trackingUrl = (
-          <Button bsSize="small" onClick={() => {window.open(query.trackingUrl)}}>
+          <Button
+            bsSize="small"
+            onClick={() => { window.open(query.trackingUrl); }}
+          >
               Track Job
           </Button>
         );
diff --git a/tests/db_engine_specs_test.py b/tests/db_engine_specs_test.py
index 626a97b..a303813 100644
--- a/tests/db_engine_specs_test.py
+++ b/tests/db_engine_specs_test.py
@@ -5,7 +5,7 @@ from __future__ import unicode_literals
 
 import unittest
 
-from superset import db_engine_specs
+from superset.db_engine_specs import HiveEngineSpec
 
 
 class DbEngineSpecsTestCase(unittest.TestCase):
@@ -13,36 +13,38 @@ class DbEngineSpecsTestCase(unittest.TestCase):
         log  = """
             17/02/07 18:26:27 INFO log.PerfLogger: <PERFLOG method=compile from=org.apache.hadoop.hive.ql.Driver>
             17/02/07 18:26:27 INFO log.PerfLogger: <PERFLOG method=parse from=org.apache.hadoop.hive.ql.Driver>
-        """
-        self.assertEquals(0, db_engine_specs.HiveEngineSpec.progress(log))
+        """.split('\n')
+        self.assertEquals(
+            0, HiveEngineSpec.progress(log))
 
     def test_0_progress(self):
         log = """
             17/02/07 18:26:27 INFO log.PerfLogger: <PERFLOG method=compile from=org.apache.hadoop.hive.ql.Driver>
             17/02/07 18:26:27 INFO log.PerfLogger: <PERFLOG method=parse from=org.apache.hadoop.hive.ql.Driver>
-        """
-        self.assertEquals(0, db_engine_specs.HiveEngineSpec.progress(log))
+        """.split('\n')
+        self.assertEquals(
+            0, HiveEngineSpec.progress(log))
 
     def test_number_of_jobs_progress(self):
         log = """
             17/02/07 19:15:55 INFO ql.Driver: Total jobs = 2
-        """
-        self.assertEquals(0, db_engine_specs.HiveEngineSpec.progress(log))
+        """.split('\n')
+        self.assertEquals(0, HiveEngineSpec.progress(log))
 
     def test_job_1_launched_progress(self):
         log = """
             17/02/07 19:15:55 INFO ql.Driver: Total jobs = 2
             17/02/07 19:15:55 INFO ql.Driver: Launching Job 1 out of 2
-        """
-        self.assertEquals(0, db_engine_specs.HiveEngineSpec.progress(log))
+        """.split('\n')
+        self.assertEquals(0, HiveEngineSpec.progress(log))
 
     def test_job_1_launched_stage_1_0_progress(self):
         log = """
             17/02/07 19:15:55 INFO ql.Driver: Total jobs = 2
             17/02/07 19:15:55 INFO ql.Driver: Launching Job 1 out of 2
             17/02/07 19:16:09 INFO exec.Task: 2017-02-07 19:16:09,173 Stage-1 map = 0%, 
reduce = 0%
-        """
-        self.assertEquals(0, db_engine_specs.HiveEngineSpec.progress(log))
+        """.split('\n')
+        self.assertEquals(0, HiveEngineSpec.progress(log))
 
     def test_job_1_launched_stage_1_map_40_progress(self):
         log = """
@@ -50,8 +52,8 @@ class DbEngineSpecsTestCase(unittest.TestCase):
             17/02/07 19:15:55 INFO ql.Driver: Launching Job 1 out of 2
             17/02/07 19:16:09 INFO exec.Task: 2017-02-07 19:16:09,173 Stage-1 map = 0%, 
reduce = 0%
             17/02/07 19:16:09 INFO exec.Task: 2017-02-07 19:16:09,173 Stage-1 map = 40%,
 reduce = 0%
-        """
-        self.assertEquals(10, db_engine_specs.HiveEngineSpec.progress(log))
+        """.split('\n')
+        self.assertEquals(10, HiveEngineSpec.progress(log))
 
     def test_job_1_launched_stage_1_map_80_reduce_40_progress(self):
         log = """
@@ -60,8 +62,8 @@ class DbEngineSpecsTestCase(unittest.TestCase):
             17/02/07 19:16:09 INFO exec.Task: 2017-02-07 19:16:09,173 Stage-1 map = 0%, 
reduce = 0%
             17/02/07 19:16:09 INFO exec.Task: 2017-02-07 19:16:09,173 Stage-1 map = 40%,
 reduce = 0%
             17/02/07 19:16:09 INFO exec.Task: 2017-02-07 19:16:09,173 Stage-1 map = 80%,
 reduce = 40%
-        """
-        self.assertEquals(30, db_engine_specs.HiveEngineSpec.progress(log))
+        """.split('\n')
+        self.assertEquals(30, HiveEngineSpec.progress(log))
 
     def test_job_1_launched_stage_2_stages_progress(self):
         log = """
@@ -72,8 +74,8 @@ class DbEngineSpecsTestCase(unittest.TestCase):
             17/02/07 19:16:09 INFO exec.Task: 2017-02-07 19:16:09,173 Stage-1 map = 80%,
 reduce = 40%
             17/02/07 19:16:09 INFO exec.Task: 2017-02-07 19:16:09,173 Stage-2 map = 0%, 
reduce = 0%
             17/02/07 19:16:09 INFO exec.Task: 2017-02-07 19:16:09,173 Stage-1 map = 100%,
 reduce = 0%
-        """
-        self.assertEquals(12, db_engine_specs.HiveEngineSpec.progress(log))
+        """.split('\n')
+        self.assertEquals(12, HiveEngineSpec.progress(log))
 
     def test_job_2_launched_stage_2_stages_progress(self):
         log = """
@@ -83,5 +85,5 @@ class DbEngineSpecsTestCase(unittest.TestCase):
             17/02/07 19:15:55 INFO ql.Driver: Launching Job 2 out of 2
             17/02/07 19:16:09 INFO exec.Task: 2017-02-07 19:16:09,173 Stage-1 map = 0%, 
reduce = 0%
             17/02/07 19:16:09 INFO exec.Task: 2017-02-07 19:16:09,173 Stage-1 map = 40%,
 reduce = 0%
-        """
-        self.assertEquals(60, db_engine_specs.HiveEngineSpec.progress(log))
+        """.split('\n')
+        self.assertEquals(60, HiveEngineSpec.progress(log))
diff --git a/tests/sqllab_tests.py b/tests/sqllab_tests.py
index 9e59adc..c3f2e9e 100644
--- a/tests/sqllab_tests.py
+++ b/tests/sqllab_tests.py
@@ -186,8 +186,8 @@ class SqlLabTests(SupersetTestCase):
             .filter_by(sql='SELECT * FROM ab_permission').one()
         ).start_time
         # Test search queries on time filter
-        from_time = 'from={}'.format(int(first_query_time))
-        to_time = 'to={}'.format(int(second_query_time))
+        from_time = 'from={}'.format(int(first_query_time)-1)
+        to_time = 'to={}'.format(int(second_query_time)+1)
         params = [from_time, to_time]
         resp = self.get_resp('/superset/search_queries?'+'&'.join(params))
         data = json.loads(resp)

-- 
To stop receiving notification emails like this one, please contact
"commits@superset.apache.org" <commits@superset.apache.org>.

Mime
View raw message