mirror of https://github.com/maxcnunes/gaper.git
parent
2f011065f0
commit
e8e114f3a6
6
gaper.go
6
gaper.go
|
@ -144,11 +144,13 @@ func restart(builder Builder, runner Runner) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := builder.Build(); err != nil {
|
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 {
|
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
|
return nil
|
||||||
|
|
|
@ -247,8 +247,7 @@ func TestGaperRestartBuildFail(t *testing.T) {
|
||||||
mockRunner.On("Exited").Return(true)
|
mockRunner.On("Exited").Return(true)
|
||||||
|
|
||||||
err := restart(mockBuilder, mockRunner)
|
err := restart(mockBuilder, mockRunner)
|
||||||
assert.NotNil(t, err, "restart error")
|
assert.Nil(t, err, "restart error")
|
||||||
assert.Equal(t, "build error: build-error", err.Error())
|
|
||||||
mockBuilder.AssertExpectations(t)
|
mockBuilder.AssertExpectations(t)
|
||||||
mockRunner.AssertExpectations(t)
|
mockRunner.AssertExpectations(t)
|
||||||
}
|
}
|
||||||
|
@ -263,8 +262,7 @@ func TestGaperRestartRunFail(t *testing.T) {
|
||||||
mockRunner.On("Exited").Return(true)
|
mockRunner.On("Exited").Return(true)
|
||||||
|
|
||||||
err := restart(mockBuilder, mockRunner)
|
err := restart(mockBuilder, mockRunner)
|
||||||
assert.NotNil(t, err, "restart error")
|
assert.Nil(t, err, "restart error")
|
||||||
assert.Equal(t, "run error: run-error", err.Error())
|
|
||||||
mockBuilder.AssertExpectations(t)
|
mockBuilder.AssertExpectations(t)
|
||||||
mockRunner.AssertExpectations(t)
|
mockRunner.AssertExpectations(t)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue