diff --git a/updater/internal/install/install_test.go b/updater/internal/install/install_test.go index e3322d42a..d2d1a464a 100644 --- a/updater/internal/install/install_test.go +++ b/updater/internal/install/install_test.go @@ -53,7 +53,6 @@ func TestInstallArtifacts(t *testing.T) { err = os.WriteFile(outDirManager, []byte("# The original manager file"), 0600) require.NoError(t, err) - svc.On("Stop").Once().Return(nil) svc.On("Update").Once().Return(nil) svc.On("Start").Once().Return(nil) @@ -96,7 +95,6 @@ func TestInstallArtifacts(t *testing.T) { copyNestedTestTxtAction.FileCreated = true require.Equal(t, []action.RollbackableAction{ - action.NewServiceStopAction(svc), copyNestedTestTxtAction, copyTestTxtAction, action.NewServiceUpdateAction(installer.logger, installer.installDir), @@ -104,23 +102,6 @@ func TestInstallArtifacts(t *testing.T) { }, actions) }) - t.Run("Stop fails", func(t *testing.T) { - outDir := t.TempDir() - svc := mocks.NewService(t) - rb := rb_mocks.NewActionAppender(t) - installer := &Installer{ - latestDir: filepath.Join("testdata", "example-install"), - installDir: outDir, - svc: svc, - logger: zaptest.NewLogger(t), - } - - svc.On("Stop").Once().Return(errors.New("stop failed")) - - err := installer.Install(rb) - require.ErrorContains(t, err, "failed to stop service") - }) - t.Run("Update fails", func(t *testing.T) { outDir := t.TempDir() svc := mocks.NewService(t) @@ -132,7 +113,6 @@ func TestInstallArtifacts(t *testing.T) { logger: zaptest.NewLogger(t), } - svc.On("Stop").Once().Return(nil) svc.On("Update").Once().Return(errors.New("uninstall failed")) actions := []action.RollbackableAction{} @@ -162,7 +142,6 @@ func TestInstallArtifacts(t *testing.T) { copyNestedTestTxtAction.FileCreated = true require.Equal(t, []action.RollbackableAction{ - action.NewServiceStopAction(svc), copyNestedTestTxtAction, copyTestTxtAction, }, actions) @@ -179,7 +158,6 @@ func TestInstallArtifacts(t *testing.T) { logger: zaptest.NewLogger(t), } - svc.On("Stop").Once().Return(nil) svc.On("Update").Once().Return(nil) svc.On("Start").Once().Return(errors.New("start failed")) @@ -211,7 +189,6 @@ func TestInstallArtifacts(t *testing.T) { copyNestedTestTxtAction.FileCreated = true require.Equal(t, []action.RollbackableAction{ - action.NewServiceStopAction(svc), copyNestedTestTxtAction, copyTestTxtAction, action.NewServiceUpdateAction(installer.logger, installer.installDir), @@ -229,20 +206,8 @@ func TestInstallArtifacts(t *testing.T) { logger: zaptest.NewLogger(t), } - svc.On("Stop").Once().Return(nil) - - actions := []action.RollbackableAction{} - rb.On("AppendAction", mock.Anything).Run(func(args mock.Arguments) { - action := args.Get(0).(action.RollbackableAction) - actions = append(actions, action) - }) - err := installer.Install(rb) require.ErrorContains(t, err, "failed to install new files") - - require.Equal(t, []action.RollbackableAction{ - action.NewServiceStopAction(svc), - }, actions) }) }