Don't leave during a restart failure

Closes #2
This commit is contained in:
Max Claus Nunes 2018-08-06 10:48:03 -03:00
parent 2f011065f0
commit e8e114f3a6
2 changed files with 6 additions and 6 deletions

View File

@ -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

View File

@ -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)
}
@ -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)
}