commit
9f9e83da99
|
@ -88,7 +88,7 @@ func (p *Plan) Execute() error {
|
|||
}
|
||||
|
||||
if err := step.Execute(p.runCfg); err != nil {
|
||||
return fmt.Errorf("in execution step %d: %w", i, err)
|
||||
return fmt.Errorf("while executing %T step: %w", step, err)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ func TestPlanTestSuite(t *testing.T) {
|
|||
|
||||
func (suite *PlanTestSuite) TestNewPlan() {
|
||||
ctrl := gomock.NewController(suite.T())
|
||||
defer ctrl.Finish()
|
||||
stepOne := NewMockStep(ctrl)
|
||||
stepTwo := NewMockStep(ctrl)
|
||||
|
||||
|
@ -65,6 +66,7 @@ func (suite *PlanTestSuite) TestNewPlan() {
|
|||
|
||||
func (suite *PlanTestSuite) TestNewPlanAbortsOnError() {
|
||||
ctrl := gomock.NewController(suite.T())
|
||||
defer ctrl.Finish()
|
||||
stepOne := NewMockStep(ctrl)
|
||||
stepTwo := NewMockStep(ctrl)
|
||||
|
||||
|
@ -87,6 +89,51 @@ func (suite *PlanTestSuite) TestNewPlanAbortsOnError() {
|
|||
suite.EqualError(err, "while preparing *helm.MockStep step: I'm starry Dave, aye, cat blew that")
|
||||
}
|
||||
|
||||
func (suite *PlanTestSuite) TestExecute() {
|
||||
ctrl := gomock.NewController(suite.T())
|
||||
defer ctrl.Finish()
|
||||
stepOne := NewMockStep(ctrl)
|
||||
stepTwo := NewMockStep(ctrl)
|
||||
|
||||
runCfg := run.Config{}
|
||||
|
||||
plan := Plan{
|
||||
steps: []Step{stepOne, stepTwo},
|
||||
runCfg: runCfg,
|
||||
}
|
||||
|
||||
stepOne.EXPECT().
|
||||
Execute(runCfg).
|
||||
Times(1)
|
||||
stepTwo.EXPECT().
|
||||
Execute(runCfg).
|
||||
Times(1)
|
||||
|
||||
suite.NoError(plan.Execute())
|
||||
}
|
||||
|
||||
func (suite *PlanTestSuite) TestExecuteAbortsOnError() {
|
||||
ctrl := gomock.NewController(suite.T())
|
||||
defer ctrl.Finish()
|
||||
stepOne := NewMockStep(ctrl)
|
||||
stepTwo := NewMockStep(ctrl)
|
||||
|
||||
runCfg := run.Config{}
|
||||
|
||||
plan := Plan{
|
||||
steps: []Step{stepOne, stepTwo},
|
||||
runCfg: runCfg,
|
||||
}
|
||||
|
||||
stepOne.EXPECT().
|
||||
Execute(runCfg).
|
||||
Times(1).
|
||||
Return(fmt.Errorf("oh, he'll gnaw"))
|
||||
|
||||
err := plan.Execute()
|
||||
suite.EqualError(err, "while executing *helm.MockStep step: oh, he'll gnaw")
|
||||
}
|
||||
|
||||
func (suite *PlanTestSuite) TestUpgrade() {
|
||||
cfg := Config{
|
||||
ChartVersion: "seventeen",
|
||||
|
|
Loading…
Reference in a new issue