diff --git a/pkg/providers/workspace/workspace.go b/pkg/providers/workspace/workspace.go index 5261fb3..a28a2f2 100644 --- a/pkg/providers/workspace/workspace.go +++ b/pkg/providers/workspace/workspace.go @@ -130,6 +130,9 @@ func (h *provider) Suspend(ctx monitorContext.Context, wfCtx wfContext.Context, var msg string if v != nil { msg, _ = v.GetString("message") + if msg == "" { + msg = fmt.Sprintf("Suspended by field %s", v.FieldName()) + } } if timestamp != "" { t, err := time.Parse(time.RFC3339, timestamp) diff --git a/pkg/providers/workspace/workspace_test.go b/pkg/providers/workspace/workspace_test.go index 3024103..49835fb 100644 --- a/pkg/providers/workspace/workspace_test.go +++ b/pkg/providers/workspace/workspace_test.go @@ -156,13 +156,12 @@ func TestProvider_Suspend(t *testing.T) { act := &mockAction{} v, err := value.NewValue(` duration: "1s" -message: "hello suspend" `, nil, "") r.NoError(err) err = p.Suspend(nil, wfCtx, v, act) r.NoError(err) r.Equal(act.suspend, true) - r.Equal(act.msg, "hello suspend") + r.Equal(act.msg, "Suspended by field ") // test second time to check if the suspend is resumed in 1s err = p.Suspend(nil, wfCtx, v, act) r.NoError(err)