@@ -21,7 +21,7 @@ def initialize
2121 def save_job_record_and_get_job_id ( start_time , command_and_option , fqdn )
2222 return 0 if $debug
2323
24- job_id = @connector . con [ :jobs ] . insert ( start_time : start_time , command_and_option : command_and_option , base_fqdn : fqdn )
24+ job_id = @connector . con [ :jobs ] . insert ( start_time :, command_and_option :, base_fqdn : fqdn )
2525 @connector . disconnect
2626 job_id
2727 end
@@ -95,7 +95,7 @@ def get_ng_test_cases_at_last_execution(cond)
9595 def get_test_case_id ( test_suite_id , case_name )
9696 return nil if $debug
9797
98- test_case = @connector . con [ :test_cases ] . filter ( test_suite_id : test_suite_id , case_name : case_name ) . first
98+ test_case = @connector . con [ :test_cases ] . filter ( test_suite_id :, case_name :) . first
9999 @connector . disconnect
100100 raise "Cannot get test_case id. test_suite_id: #{ test_suite_id } , case_name: #{ case_name } " if test_case . nil?
101101
@@ -106,11 +106,26 @@ def get_test_case_id(test_suite_id, case_name)
106106 # @param [Int] job_id
107107 # @return [Int] round
108108 def get_last_round_from_job_id ( job_id )
109- round = @connector . con [ :test_case_results ] . where ( job_id : job_id ) . max ( :round )
109+ round = @connector . con [ :test_case_results ] . where ( job_id :) . max ( :round )
110110 @connector . disconnect
111111 round
112112 end
113113
114+ # Update job record with end_time and duration
115+ # @param [Integer] job_id
116+ # @param [Time] end_time
117+ # @param [Float] duration
118+ def update_job_record ( job_id , end_time , duration )
119+ rounded_duration = duration . round ( 2 )
120+ return if $debug
121+
122+ @connector . con [ :jobs ] . where ( id : job_id ) . update (
123+ end_time :,
124+ duration : rounded_duration
125+ )
126+ @connector . disconnect
127+ end
128+
114129 private
115130
116131 # Common method for getting suite
@@ -131,7 +146,7 @@ def get_suite_id_from_saved_test_suite(saved_test_suite, test_data)
131146 test_suite_name : test_data [ :test_suite_name ] ,
132147 suite_description : test_data [ :suite ] [ :desc ] ,
133148 github_url : @config [ :test_code_repo ] ,
134- file_path : file_path
149+ file_path :
135150 )
136151 saved_test_suite [ :id ]
137152 else # If there is no test_suite, save new record and return suite_id.
@@ -143,7 +158,7 @@ def get_suite_id_from_saved_test_suite(saved_test_suite, test_data)
143158 test_suite_name : test_data [ :test_suite_name ] ,
144159 suite_description : test_data [ :suite ] [ :desc ] ,
145160 github_url : @config [ :test_code_repo ] ,
146- file_path : file_path
161+ file_path :
147162 )
148163 end
149164 end
@@ -159,11 +174,11 @@ def insert_and_return_label_ids(labels)
159174 return nil if labels . empty?
160175
161176 labels . each do |label_name |
162- label = @connector . con [ :labels ] . filter ( label_name : label_name ) . first
177+ label = @connector . con [ :labels ] . filter ( label_name :) . first
163178 label_ids << if label
164179 label [ :id ]
165180 else
166- @connector . con [ :labels ] . insert ( label_name : label_name )
181+ @connector . con [ :labels ] . insert ( label_name :)
167182 end
168183 end
169184 label_ids
@@ -180,14 +195,14 @@ def update_test_case_and_test_case_label(suite_id, test_case, label_ids)
180195 # Create new connection
181196 # If there is no labels, return nil
182197 label_ids &.each do |label_id |
183- @connector . con [ :test_case_labels ] . insert ( test_case_id : saved_test_case [ :id ] , label_id : label_id )
198+ @connector . con [ :test_case_labels ] . insert ( test_case_id : saved_test_case [ :id ] , label_id :)
184199 end
185200 else
186201 # Add case data
187202 test_case_id = @connector . con [ :test_cases ] . insert ( test_suite_id : suite_id , case_name : test_case [ :case_name ] , case_description : test_case [ :desc ] )
188203 # If there is no labels, return nil
189204 label_ids &.each do |label_id |
190- @connector . con [ :test_case_labels ] . insert ( test_case_id : test_case_id , label_id : label_id )
205+ @connector . con [ :test_case_labels ] . insert ( test_case_id :, label_id :)
191206 end
192207 end
193208 end
0 commit comments