Skip to content

Commit

Permalink
Fix testzz
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Jul 27, 2017
1 parent b9aff7b commit 34aee11
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 24 deletions.
5 changes: 4 additions & 1 deletion superset/assets/javascripts/SqlLab/components/ResultSet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
);
Expand Down
40 changes: 21 additions & 19 deletions tests/db_engine_specs_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,53 +5,55 @@

import unittest

from superset import db_engine_specs
from superset.db_engine_specs import HiveEngineSpec


class DbEngineSpecsTestCase(unittest.TestCase):
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_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 = """
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%
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 = """
Expand All @@ -60,8 +62,8 @@ def test_job_1_launched_stage_1_map_80_reduce_40_progress(self):
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 = """
Expand All @@ -72,8 +74,8 @@ def test_job_1_launched_stage_2_stages_progress(self):
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 = """
Expand All @@ -83,5 +85,5 @@ def test_job_2_launched_stage_2_stages_progress(self):
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))
5 changes: 1 addition & 4 deletions tests/sqllab_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,9 @@ def test_search_query_on_time(self):
from_time = 'from={}'.format(int(first_query_time))
to_time = 'to={}'.format(int(second_query_time))
params = [from_time, to_time]
resp = self.get_resp('/superset/search_queries?'+'&'.join(params))
resp = self.get_resp('/superset/search_queries?' + '&'.join(params))
data = json.loads(resp)
self.assertEquals(2, len(data))
for k in data:
self.assertLess(int(first_query_time), k['startDttm'])
self.assertLess(k['startDttm'], int(second_query_time))

def test_alias_duplicate(self):
self.run_sql(
Expand Down

0 comments on commit 34aee11

Please sign in to comment.