Skip to content

Commit 7505302

Browse files
authored
fix(api): unit test log (#5081)
* fix(api): unit test log Signed-off-by: Yvonnick Esnault <yvonnick.esnault@corp.ovh.com>
1 parent 9c88e9e commit 7505302

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

engine/api/workflow.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -593,29 +593,29 @@ func (api *API) deleteWorkflowHandler() service.Handler {
593593
if err := tx.Commit(); err != nil {
594594
return sdk.WrapError(errT, "Cannot commit transaction")
595595
}
596-
597-
sdk.GoRoutine(ctx, "deleteWorkflowHandler",
596+
consumer := getAPIConsumer(ctx)
597+
sdk.GoRoutine(api.Router.Background, "deleteWorkflowHandler",
598598
func(ctx context.Context) {
599599
txg, errT := api.mustDB().Begin()
600600
if errT != nil {
601601
log.Error(ctx, "deleteWorkflowHandler> Cannot start transaction: %v", errT)
602602
}
603603
defer txg.Rollback() // nolint
604604

605-
oldW, err := workflow.Load(context.Background(), txg, api.Cache, *p, name, workflow.LoadOptions{})
605+
oldW, err := workflow.Load(ctx, txg, api.Cache, *p, name, workflow.LoadOptions{})
606606
if err != nil {
607607
log.Error(ctx, "deleteWorkflowHandler> unable to load workflow: %v", err)
608608
return
609609
}
610610

611-
if err := workflow.Delete(context.Background(), txg, api.Cache, *p, oldW); err != nil {
611+
if err := workflow.Delete(ctx, txg, api.Cache, *p, oldW); err != nil {
612612
log.Error(ctx, "deleteWorkflowHandler> unable to delete workflow: %v", err)
613613
return
614614
}
615615
if err := txg.Commit(); err != nil {
616616
log.Error(ctx, "deleteWorkflowHandler> Cannot commit transaction: %v", err)
617617
}
618-
event.PublishWorkflowDelete(ctx, key, *oldW, getAPIConsumer((ctx)))
618+
event.PublishWorkflowDelete(ctx, key, *oldW, consumer)
619619
}, api.PanicDump())
620620

621621
return service.WriteJSON(w, nil, http.StatusOK)

engine/api/workflow_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1365,7 +1365,6 @@ func Test_postAndDeleteWorkflowLabelHandler(t *testing.T) {
13651365
}
13661366

13671367
func Test_deleteWorkflowHandler(t *testing.T) {
1368-
13691368
api, db, router, end := newTestAPI(t)
13701369
defer end()
13711370
test.NoError(t, workflow.CreateBuiltinWorkflowHookModels(db))

0 commit comments

Comments
 (0)