From effd89776cf0896eed2838c1272773cf00d2f26b Mon Sep 17 00:00:00 2001 From: Hyokeun Jeon Date: Thu, 14 Nov 2019 12:52:42 +0900 Subject: [PATCH] Test - Get build_project_id from SR number, Handle non SR result Change-Id: Ieccdf98b255b6e8220a4e587639f51b68670f0ca --- job_trbs_test_result_receiver.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/job_trbs_test_result_receiver.py b/job_trbs_test_result_receiver.py index 190e045..7a9d893 100755 --- a/job_trbs_test_result_receiver.py +++ b/job_trbs_test_result_receiver.py @@ -56,6 +56,10 @@ def is_test_succeeded(data, is_ref_exist, is_perf_exist): def insert_test_stage(data, MYSQL, sr_id, snapshot, is_ref_exist, is_perf_exist, ordering=None ): + if sr_id is None: + print ("No SR ID provided. Skip...") + return + INFO_STAGE_ID_FOR_TEST = 101 status = 'F'; @@ -63,8 +67,9 @@ def insert_test_stage(data, MYSQL, sr_id, snapshot, is_ref_exist, is_perf_exist, status = 'S'; build_project_id = 0 - sql_data = (snapshot,) - sql = "SELECT build_project_id FROM build_snapshot WHERE snapshot_name=%s LIMIT 1" + sql_data = (sr_id,) + sql = "select build_project_id FROM sr_stage WHERE sr_status_id=%s " \ + " AND info_stage_id<=8 AND build_project_id!=0 ORDER BY stage_start_time LIMIT 1" MYSQL['cursor'].execute(sql, sql_data) row = MYSQL['cursor'].fetchall() if len(row) > 0: @@ -226,8 +231,9 @@ if __name__ == "__main__": else: print ("[ERROR] MYSQL : Can not search sr_status where sr = %(sr)s" % DINFO) - exit(1) - + DINFO['sr_status_id'] = None + DINFO['status'] = None + DINFO['trbs_build_project_id'] = None # If reference is exists, then insert into DB. -- 2.7.4