Skip to content

Commit

Permalink
cleanup(oonirun): remove unused testing-hook argument (#1610)
Browse files Browse the repository at this point in the history
This diff removes an unused argument from a testing hook. Removing this
argument simplifies the implementation of the richer input patches and
does not change the behavior in any way since the argument wasn't used.

Part of ooni/probe#2607.
bassosimone authored Jun 4, 2024
1 parent 485c208 commit c12991a
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions internal/oonirun/experiment.go
Original file line number Diff line number Diff line change
@@ -67,7 +67,7 @@ type Experiment struct {
newSubmitterFn func(ctx context.Context) (model.Submitter, error)

// newSaverFn is OPTIONAL and used for testing.
newSaverFn func(experiment model.Experiment) (model.Saver, error)
newSaverFn func() (model.Saver, error)

// newInputProcessorFn is OPTIONAL and used for testing.
newInputProcessorFn func(experiment model.Experiment, inputList []model.OOAPIURLInfo,
@@ -121,7 +121,7 @@ func (ed *Experiment) Run(ctx context.Context) error {
}

// 7. create the saver
saver, err := ed.newSaver(experiment)
saver, err := ed.newSaver()
if err != nil {
return err
}
@@ -161,9 +161,9 @@ func (ed *Experiment) newInputProcessor(experiment model.Experiment,
}

// newSaver creates a new engine.Saver instance.
func (ed *Experiment) newSaver(experiment model.Experiment) (model.Saver, error) {
func (ed *Experiment) newSaver() (model.Saver, error) {
if ed.newSaverFn != nil {
return ed.newSaverFn(experiment)
return ed.newSaverFn()
}
return NewSaver(SaverConfig{
Enabled: !ed.NoJSON,
6 changes: 3 additions & 3 deletions internal/oonirun/experiment_test.go
Original file line number Diff line number Diff line change
@@ -171,7 +171,7 @@ func TestExperimentRun(t *testing.T) {
newExperimentBuilderFn func(experimentName string) (model.ExperimentBuilder, error)
newInputLoaderFn func(inputPolicy model.InputPolicy) inputLoader
newSubmitterFn func(ctx context.Context) (model.Submitter, error)
newSaverFn func(experiment model.Experiment) (model.Saver, error)
newSaverFn func() (model.Saver, error)
newInputProcessorFn func(experiment model.Experiment, inputList []model.OOAPIURLInfo, saver model.Saver, submitter model.Submitter) inputProcessor
}
type args struct {
@@ -319,7 +319,7 @@ func TestExperimentRun(t *testing.T) {
newSubmitterFn: func(ctx context.Context) (model.Submitter, error) {
return &mocks.Submitter{}, nil
},
newSaverFn: func(experiment model.Experiment) (model.Saver, error) {
newSaverFn: func() (model.Saver, error) {
return nil, errMocked
},
},
@@ -365,7 +365,7 @@ func TestExperimentRun(t *testing.T) {
newSubmitterFn: func(ctx context.Context) (model.Submitter, error) {
return &mocks.Submitter{}, nil
},
newSaverFn: func(experiment model.Experiment) (model.Saver, error) {
newSaverFn: func() (model.Saver, error) {
return &mocks.Saver{}, nil
},
newInputProcessorFn: func(experiment model.Experiment, inputList []model.OOAPIURLInfo,

0 comments on commit c12991a

Please sign in to comment.