diff --git a/component/componentstatus/status.go b/component/componentstatus/status.go index 14e3554dd2a..57a691dab57 100644 --- a/component/componentstatus/status.go +++ b/component/componentstatus/status.go @@ -119,3 +119,10 @@ func NewFatalErrorEvent(err error) *Event { return ev } +// StatusIsError returns true for error statuses (e.g. StatusRecoverableError, +// StatusPermanentError, or StatusFatalError) +func StatusIsError(status Status) bool { + return status == StatusRecoverableError || + status == StatusPermanentError || + status == StatusFatalError +} diff --git a/component/componentstatus/status_test.go b/component/componentstatus/status_test.go index aeb7e3e6d23..7d66f2c5c3d 100644 --- a/component/componentstatus/status_test.go +++ b/component/componentstatus/status_test.go @@ -5,7 +5,6 @@ package componentstatus import ( "fmt" "testing" - "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -49,7 +48,6 @@ func TestStatusEventsWithError(t *testing.T) { } } - func TestStatusIsError(t *testing.T) { for _, tc := range []struct { status Status @@ -90,4 +88,3 @@ func TestStatusIsError(t *testing.T) { }) } } -