Skip to content

Commit

Permalink
Don't leave during a restart failure
Browse files Browse the repository at this point in the history
Closes #2
  • Loading branch information
maxcnunes committed Aug 6, 2018
1 parent 2f01106 commit e8e114f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 4 additions & 2 deletions gaper.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,13 @@ func restart(builder Builder, runner Runner) error {
}

if err := builder.Build(); err != nil {
return fmt.Errorf("build error: %v", err)
logger.Error("Error building binary during a restart: ", err)
return nil
}

if _, err := runner.Run(); err != nil {
return fmt.Errorf("run error: %v", err)
logger.Error("Error starting process during a restart: ", err)
return nil
}

return nil
Expand Down
6 changes: 2 additions & 4 deletions gaper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,7 @@ func TestGaperRestartBuildFail(t *testing.T) {
mockRunner.On("Exited").Return(true)

err := restart(mockBuilder, mockRunner)
assert.NotNil(t, err, "restart error")
assert.Equal(t, "build error: build-error", err.Error())
assert.Nil(t, err, "restart error")
mockBuilder.AssertExpectations(t)
mockRunner.AssertExpectations(t)
}
Expand All @@ -263,8 +262,7 @@ func TestGaperRestartRunFail(t *testing.T) {
mockRunner.On("Exited").Return(true)

err := restart(mockBuilder, mockRunner)
assert.NotNil(t, err, "restart error")
assert.Equal(t, "run error: run-error", err.Error())
assert.Nil(t, err, "restart error")
mockBuilder.AssertExpectations(t)
mockRunner.AssertExpectations(t)
}
Expand Down

0 comments on commit e8e114f

Please sign in to comment.