Skip to content

Commit

Permalink
Streamline error assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
mwear committed Oct 6, 2023
1 parent 5361925 commit 711fb73
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 5 deletions.
1 change: 0 additions & 1 deletion internal/sharedcomponent/sharedcomponent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ func TestSharedComponentsReportStatus(t *testing.T) {

// simulate an error
err = comp.telemetry.ReportComponentStatus(component.NewStatusEvent(component.StatusNone))
require.Error(t, err)
require.ErrorIs(t, err, assert.AnError)

// stopping
Expand Down
3 changes: 0 additions & 3 deletions service/internal/status/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,11 @@ func TestValidSeqsToStopped(t *testing.T) {
require.NoError(t, fsm.transition(ev))
// skipping to stopped is not allowed
err := fsm.transition(component.NewStatusEvent(component.StatusStopped))
require.Error(t, err)
require.ErrorIs(t, err, errInvalidStateTransition)

// stopping -> stopped is allowed for non-fatal, non-permanent errors
err = fsm.transition(component.NewStatusEvent(component.StatusStopping))
if ev.Status() == component.StatusPermanentError || ev.Status() == component.StatusFatalError {
require.Error(t, err)
require.ErrorIs(t, err, errInvalidStateTransition)
} else {
require.NoError(t, err)
Expand Down Expand Up @@ -261,7 +259,6 @@ func TestStatusFuncReady(t *testing.T) {
id := &component.InstanceID{}

err := serviceStatusFn(id, component.NewStatusEvent(component.StatusStarting))
require.Error(t, err)
require.ErrorIs(t, err, errStatusNotReady)

init()
Expand Down
1 change: 0 additions & 1 deletion service/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,6 @@ func TestServiceFatalError(t *testing.T) {

err = <-srv.host.asyncErrorChannel

require.Error(t, err)
require.ErrorIs(t, err, assert.AnError)
}

Expand Down

0 comments on commit 711fb73

Please sign in to comment.