Remove the cfg argument from Step.Execute [#67]

This is the first step toward removing run.Config entirely. InitKube was
the only Step that even used cfg in its Execute function; the rest just
discarded it.
This commit is contained in:
Erin Call
2020-01-16 15:30:21 -08:00
parent 88bb8085b0
commit 231138563c
17 changed files with 43 additions and 35 deletions

View File

@@ -48,15 +48,15 @@ func (mr *MockStepMockRecorder) Prepare(arg0 interface{}) *gomock.Call {
}
// Execute mocks base method
func (m *MockStep) Execute(arg0 run.Config) error {
func (m *MockStep) Execute() error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Execute", arg0)
ret := m.ctrl.Call(m, "Execute")
ret0, _ := ret[0].(error)
return ret0
}
// Execute indicates an expected call of Execute
func (mr *MockStepMockRecorder) Execute(arg0 interface{}) *gomock.Call {
func (mr *MockStepMockRecorder) Execute() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Execute", reflect.TypeOf((*MockStep)(nil).Execute), arg0)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Execute", reflect.TypeOf((*MockStep)(nil).Execute))
}

View File

@@ -15,7 +15,7 @@ const (
// A Step is one step in the plan.
type Step interface {
Prepare(run.Config) error
Execute(run.Config) error
Execute() error
}
// A Plan is a series of steps to perform.
@@ -84,7 +84,7 @@ func (p *Plan) Execute() error {
fmt.Fprintf(p.cfg.Stderr, "calling %T.Execute (step %d)\n", step, i)
}
if err := step.Execute(p.runCfg); err != nil {
if err := step.Execute(); err != nil {
return fmt.Errorf("while executing %T step: %w", step, err)
}
}

View File

@@ -98,10 +98,10 @@ func (suite *PlanTestSuite) TestExecute() {
}
stepOne.EXPECT().
Execute(runCfg).
Execute().
Times(1)
stepTwo.EXPECT().
Execute(runCfg).
Execute().
Times(1)
suite.NoError(plan.Execute())
@@ -121,7 +121,7 @@ func (suite *PlanTestSuite) TestExecuteAbortsOnError() {
}
stepOne.EXPECT().
Execute(runCfg).
Execute().
Times(1).
Return(fmt.Errorf("oh, he'll gnaw"))