diff --git a/internal/oonirun/experiment.go b/internal/oonirun/experiment.go index 3b4fd9afc..d5175f641 100644 --- a/internal/oonirun/experiment.go +++ b/internal/oonirun/experiment.go @@ -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, diff --git a/internal/oonirun/experiment_test.go b/internal/oonirun/experiment_test.go index 2a3455e3a..022ba49c6 100644 --- a/internal/oonirun/experiment_test.go +++ b/internal/oonirun/experiment_test.go @@ -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,