code clean up
This commit is contained in:
parent
ef85a60756
commit
53aacef29c
4 changed files with 3 additions and 9 deletions
|
@ -124,7 +124,7 @@ class Gitlab(object):
|
||||||
|
|
||||||
return raw_data_list
|
return raw_data_list
|
||||||
|
|
||||||
def find_job_id(self, job_name, pipeline_id=None, job_status="success", suffix=None):
|
def find_job_id(self, job_name, pipeline_id=None, job_status="success"):
|
||||||
"""
|
"""
|
||||||
Get Job ID from job name of specific pipeline
|
Get Job ID from job name of specific pipeline
|
||||||
|
|
||||||
|
@ -132,7 +132,6 @@ class Gitlab(object):
|
||||||
:param pipeline_id: If None, will get pipeline id from CI pre-defined variable.
|
:param pipeline_id: If None, will get pipeline id from CI pre-defined variable.
|
||||||
:param job_status: status of job. One pipeline could have multiple jobs with same name after retry.
|
:param job_status: status of job. One pipeline could have multiple jobs with same name after retry.
|
||||||
job_status is used to filter these jobs.
|
job_status is used to filter these jobs.
|
||||||
:param suffix: suffix of the job. e.g. 'limit' for build only needed apps.
|
|
||||||
:return: a list of job IDs (parallel job will generate multiple jobs)
|
:return: a list of job IDs (parallel job will generate multiple jobs)
|
||||||
"""
|
"""
|
||||||
job_id_list = []
|
job_id_list = []
|
||||||
|
@ -145,9 +144,6 @@ class Gitlab(object):
|
||||||
if match:
|
if match:
|
||||||
if match.group(1) == job_name and job.status == job_status:
|
if match.group(1) == job_name and job.status == job_status:
|
||||||
job_id_list.append({"id": job.id, "parallel_num": match.group(3)})
|
job_id_list.append({"id": job.id, "parallel_num": match.group(3)})
|
||||||
elif suffix:
|
|
||||||
if match.group(1) == "{}_{}".format(job_name, suffix) and job.status == job_status:
|
|
||||||
job_id_list.append({"id": job.id, "parallel_num": match.group(3)})
|
|
||||||
return job_id_list
|
return job_id_list
|
||||||
|
|
||||||
@retry_download
|
@retry_download
|
||||||
|
|
|
@ -125,6 +125,7 @@ class Search(object):
|
||||||
search all test cases from a folder or file, and then do case replicate.
|
search all test cases from a folder or file, and then do case replicate.
|
||||||
|
|
||||||
:param test_case: test case file(s) path
|
:param test_case: test case file(s) path
|
||||||
|
:param test_case_file_pattern: unix filename pattern
|
||||||
:return: a list of replicated test methods
|
:return: a list of replicated test methods
|
||||||
"""
|
"""
|
||||||
test_case_files = cls._search_test_case_files(test_case, test_case_file_pattern or cls.TEST_CASE_FILE_PATTERN)
|
test_case_files = cls._search_test_case_files(test_case, test_case_file_pattern or cls.TEST_CASE_FILE_PATTERN)
|
||||||
|
|
|
@ -65,7 +65,7 @@ def create_artifact_index_file(project_id=None, pipeline_id=None, case_group=Exa
|
||||||
return "{}/list_job_{}.json".format(case_group.BUILD_LOCAL_DIR, parallel or 1)
|
return "{}/list_job_{}.json".format(case_group.BUILD_LOCAL_DIR, parallel or 1)
|
||||||
|
|
||||||
for build_job_name in case_group.BUILD_JOB_NAMES:
|
for build_job_name in case_group.BUILD_JOB_NAMES:
|
||||||
job_info_list = gitlab_inst.find_job_id(build_job_name, pipeline_id=pipeline_id, suffix='limit')
|
job_info_list = gitlab_inst.find_job_id(build_job_name, pipeline_id=pipeline_id)
|
||||||
for job_info in job_info_list:
|
for job_info in job_info_list:
|
||||||
raw_data = gitlab_inst.download_artifact(job_info["id"], [format_build_log_path()])[0]
|
raw_data = gitlab_inst.download_artifact(job_info["id"], [format_build_log_path()])[0]
|
||||||
build_info_list = [json.loads(line) for line in raw_data.splitlines()]
|
build_info_list = [json.loads(line) for line in raw_data.splitlines()]
|
||||||
|
|
|
@ -57,7 +57,6 @@ def main():
|
||||||
|
|
||||||
actions.add_parser('example_test', parents=[common])
|
actions.add_parser('example_test', parents=[common])
|
||||||
actions.add_parser('test_apps', parents=[common])
|
actions.add_parser('test_apps', parents=[common])
|
||||||
# actions.add_parser('unit_test', parents=[common])
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
@ -68,8 +67,6 @@ def main():
|
||||||
elif args.action == 'test_apps':
|
elif args.action == 'test_apps':
|
||||||
CIExampleAssignTest.CI_TEST_JOB_PATTERN = re.compile(r'^test_app_test_.+')
|
CIExampleAssignTest.CI_TEST_JOB_PATTERN = re.compile(r'^test_app_test_.+')
|
||||||
assign = CIExampleAssignTest(path, args.ci_config_file, TestAppsGroup)
|
assign = CIExampleAssignTest(path, args.ci_config_file, TestAppsGroup)
|
||||||
# elif args.action == 'unit_test':
|
|
||||||
# assign = UnitTestAssignTest(args.test_case, args.ci_config_file)
|
|
||||||
else:
|
else:
|
||||||
raise SystemExit(1) # which is impossible
|
raise SystemExit(1) # which is impossible
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue