@@ -202,23 +202,26 @@ This function creates a run in a specific project.
202
202
- @return ID of the created run
203
203
*/
204
204
func DeleteRun () {
205
+ // Do something only if run id is valid
206
+ if runID <= 0 {
207
+ logrus .Debug ("Nothing to delete!" )
208
+ return
209
+ }
210
+
205
211
cfg := qase .NewConfiguration ()
206
212
cfg .AddDefaultHeader ("Token" , apiToken )
207
213
client := qase .NewAPIClient (cfg )
208
214
209
- // Do something only if run id is valid
210
- if runID > 0 {
211
- if checkProject (client , projectCode ) {
212
- logrus .Debugf ("Project %s is validated" , projectCode )
215
+ if checkProject (client , projectCode ) {
216
+ logrus .Debugf ("Project %s is validated" , projectCode )
213
217
214
- // Delete test run
215
- deleteRun (client , runID )
216
- logrus .Debugf ("Run id %d has been deleted" , runID )
218
+ // Delete test run
219
+ deleteRun (client , runID )
220
+ logrus .Debugf ("Run id %d has been deleted" , runID )
217
221
218
- // Check that we can't access the run
219
- if itExists := checkRun (client , runID ); itExists {
220
- logrus .Fatalf ("Run %d still exists" , runID )
221
- }
222
+ // Check that we can't access the run
223
+ if itExists := checkRun (client , runID ); itExists {
224
+ logrus .Fatalf ("Run %d still exists" , runID )
222
225
}
223
226
}
224
227
}
@@ -228,37 +231,38 @@ This function finalises the results for a specific run.
228
231
- @return Fatal on error
229
232
*/
230
233
func FinalizeResults () {
234
+ // Do something only if run id is valid
235
+ if runID <= 0 {
236
+ logrus .Debug ("Nothing to finalize!" )
237
+ return
238
+ }
239
+
231
240
cfg := qase .NewConfiguration ()
232
241
cfg .AddDefaultHeader ("Token" , apiToken )
233
242
client := qase .NewAPIClient (cfg )
234
243
235
- // Do something only if run id is valid
236
- if runID > 0 {
237
- if checkProject (client , projectCode ) {
238
- logrus .Debugf ("Project %s is validated" , projectCode )
239
-
240
- // Complete run if needed
241
- if runComplete != "" {
242
- completeRun (client , runID )
244
+ if checkProject (client , projectCode ) {
245
+ logrus .Debugf ("Project %s is validated" , projectCode )
243
246
244
- // Log in Ginkgo
245
- ginkgo . GinkgoWriter . Printf ( "Report for run ID %d has been complete \n " , runID )
246
- }
247
+ // Complete run if needed
248
+ if runComplete != "" {
249
+ completeRun ( client , runID )
247
250
248
- // Make the run publicly available
249
- if report != "" {
250
- runPublicResponse , _ , err := client .RunsApi .UpdateRunPublicity (context .TODO (), qase.RunPublic {Status : true }, projectCode , runID )
251
- if err != nil {
252
- logrus .Fatalf ("Error on publishing run: %v" , err )
253
- }
254
- logrus .Debugf ("Published run available here: %s" , runPublicResponse .Result .Url )
251
+ // Log in Ginkgo
252
+ ginkgo .GinkgoWriter .Printf ("Report for run ID %d has been complete\n " , runID )
253
+ }
255
254
256
- // Log in Ginkgo
257
- ginkgo .GinkgoWriter .Printf ("Report for run ID %d available: %s\n " , runID , runPublicResponse .Result .Url )
255
+ // Make the run publicly available
256
+ if report != "" {
257
+ runPublicResponse , _ , err := client .RunsApi .UpdateRunPublicity (context .TODO (), qase.RunPublic {Status : true }, projectCode , runID )
258
+ if err != nil {
259
+ logrus .Fatalf ("Error on publishing run: %v" , err )
258
260
}
261
+ logrus .Debugf ("Published run available here: %s" , runPublicResponse .Result .Url )
262
+
263
+ // Log in Ginkgo
264
+ ginkgo .GinkgoWriter .Printf ("Report for run ID %d available: %s\n " , runID , runPublicResponse .Result .Url )
259
265
}
260
- } else {
261
- logrus .Debug ("Nothing to finalize!" )
262
266
}
263
267
}
264
268
@@ -293,7 +297,7 @@ This function creates/updates run/cases for specific Ginkgo tests.
293
297
*/
294
298
func Qase (id int64 , testReport ginkgo.SpecReport ) {
295
299
// A negative or zero run/case ID means that we won't log anything
296
- if runID = = 0 || id <= 0 {
300
+ if runID < = 0 || id <= 0 {
297
301
return
298
302
}
299
303
0 commit comments