Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Aiee committed Jul 12, 2021
1 parent 6a57e5d commit 15e38a9
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions tests/job/test_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ def test_failed(self):
self.check_resp_failed(resp, ttypes.ErrorCode.E_EXECUTION_ERROR)

def test_succeeded(self):
def check_jobs_resp_obj(resp_row, job_name):
assert resp_row[1].as_string() == job_name
assert resp_row[2].is_string()
assert resp_row[3].is_datetime()
assert resp_row[4].is_datetime()

resp = self.client.execute('CREATE SPACE IF NOT EXISTS space_for_jobs(partition_num=9, replica_factor=1, vid_type=FIXED_STRING(20));'
'USE space_for_jobs;')
self.check_resp_succeeded(resp)
Expand Down Expand Up @@ -51,33 +57,20 @@ def test_succeeded(self):
expect_values = [[re.compile(r'\d+')]]
self.check_result(resp, expect_values, is_regex=True)

time.sleep(3)
time.sleep(10)
resp = self.client.execute('SHOW JOBS;')
self.check_resp_succeeded(resp)
expect_col_names = ['Job Id', 'Command', 'Status', 'Start Time', 'Stop Time']
self.check_column_names(resp, expect_col_names)
assert resp.row_values(0)[1].as_string() == 'STATS'
assert resp.row_values(0)[2].is_string()
assert resp.row_values(0)[3].is_datetime()
assert resp.row_values(0)[4].is_datetime()
assert resp.row_values(1)[1].as_string() == 'FLUSH'
assert resp.row_values(1)[2].is_string()
assert resp.row_values(1)[3].is_datetime()
assert resp.row_values(1)[4].is_datetime()
assert resp.row_values(2)[1].as_string() == 'COMPACT'
assert resp.row_values(2)[2].is_string()
assert resp.row_values(2)[3].is_datetime()
assert resp.row_values(2)[4].is_datetime()
check_jobs_resp_obj(resp.row_values(0), 'STATS')
check_jobs_resp_obj(resp.row_values(1), 'FLUSH')
check_jobs_resp_obj(resp.row_values(2), 'COMPACT')

job_id = resp.row_values(0)[0].as_int()
resp = self.client.execute('SHOW JOB {};'.format(job_id))
self.check_resp_succeeded(resp)
expect_col_names = ['Job Id(TaskId)', 'Command(Dest)', 'Status', 'Start Time', 'Stop Time']
self.check_column_names(resp, expect_col_names)
assert resp.row_values(0)[1].as_string() == 'STATS'
assert resp.row_values(0)[2].is_string()
assert resp.row_values(0)[3].is_datetime()
assert resp.row_values(0)[4].is_datetime()
check_jobs_resp_obj(resp.row_values(0), 'STATS')

job_id = resp.row_values(0)[0].as_int()
resp = self.client.execute('STOP JOB {};'.format(job_id))
Expand Down

0 comments on commit 15e38a9

Please sign in to comment.