From e8e114f3a68f61f7f62469a5bdea63d84b77a367 Mon Sep 17 00:00:00 2001 From: Max Claus Nunes Date: Mon, 6 Aug 2018 10:48:03 -0300 Subject: [PATCH] Don't leave during a restart failure Closes #2 --- gaper.go | 6 ++++-- gaper_test.go | 6 ++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gaper.go b/gaper.go index c5d044e..d5d7186 100644 --- a/gaper.go +++ b/gaper.go @@ -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 diff --git a/gaper_test.go b/gaper_test.go index 15c9252..c5862d9 100644 --- a/gaper_test.go +++ b/gaper_test.go @@ -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) }