@@ -17,12 +17,10 @@ import (
1717	"github.com/linuxboot/contest/pkg/event" 
1818	"github.com/linuxboot/contest/pkg/event/testevent" 
1919	"github.com/linuxboot/contest/pkg/job" 
20- 	"github.com/linuxboot/contest/pkg/pluginregistry" 
2120	"github.com/linuxboot/contest/pkg/storage" 
2221	"github.com/linuxboot/contest/pkg/target" 
2322	"github.com/linuxboot/contest/pkg/test" 
2423	"github.com/linuxboot/contest/pkg/xcontext" 
25- 	"github.com/linuxboot/contest/plugins/targetlocker/inmemory" 
2624	"github.com/linuxboot/contest/plugins/targetmanagers/targetlist" 
2725	"github.com/linuxboot/contest/plugins/teststeps" 
2826	"github.com/linuxboot/contest/plugins/teststeps/echo" 
@@ -84,24 +82,16 @@ func (r *collectingReporter) FinalReport(ctx xcontext.Context, parameters interf
8482}
8583
8684type  JobRunnerSuite  struct  {
87- 	suite.Suite 
88- 
89- 	pluginRegistry   * pluginregistry.PluginRegistry 
90- 	internalStorage  * MemoryStorageEngine 
85+ 	BaseTestSuite 
9186}
9287
9388func  TestTestStepSuite (t  * testing.T ) {
9489	suite .Run (t , & JobRunnerSuite {})
9590}
9691
9792func  (s  * JobRunnerSuite ) SetupTest () {
98- 	storageEngine , err  :=  NewMemoryStorageEngine ()
99- 	require .NoError (s .T (), err )
100- 	s .internalStorage  =  storageEngine 
93+ 	s .BaseTestSuite .SetupTest ()
10194
102- 	target .SetLocker (inmemory .New (clock .New ()))
103- 
104- 	s .pluginRegistry  =  pluginregistry .NewPluginRegistry (xcontext .Background ())
10595	for  _ , e  :=  range  []struct  {
10696		name     string 
10797		factory  test.TestStepFactory 
@@ -113,40 +103,11 @@ func (s *JobRunnerSuite) SetupTest() {
113103	}
114104}
115105
116- func  (s  * JobRunnerSuite ) TearDownTest () {
117- 	target .SetLocker (nil )
118- }
119- 
120- func  (s  * JobRunnerSuite ) registerStateFullStep (
121- 	runFunction  func (
122- 		ctx  xcontext.Context , ch  test.TestStepChannels , params  test.TestStepParameters ,
123- 		ev  testevent.Emitter , resumeState  json.RawMessage ) (json.RawMessage , error ),
124- 	validateFunction  func (ctx  xcontext.Context , params  test.TestStepParameters ) error ) error  {
125- 
126- 	return  s .pluginRegistry .RegisterTestStep (stateFullStepName , func () test.TestStep  {
127- 		return  & stateFullStep {
128- 			runFunction :      runFunction ,
129- 			validateFunction : validateFunction ,
130- 		}
131- 	}, nil )
132- }
133- 
134- func  (s  * JobRunnerSuite ) newStep (label , name  string , params  test.TestStepParameters ) test.TestStepBundle  {
135- 	td  :=  test.TestStepDescriptor {
136- 		Name :       name ,
137- 		Label :      label ,
138- 		Parameters : params ,
139- 	}
140- 	sb , err  :=  s .pluginRegistry .NewTestStepBundle (ctx , td )
141- 	require .NoError (s .T (), err )
142- 	return  * sb 
143- }
144- 
145106func  (s  * JobRunnerSuite ) TestSimpleJobStartFinish () {
146107	var  mu  sync.Mutex 
147108	var  resultTargets  []* target.Target 
148109
149- 	require .NoError (s .T (), s .registerStateFullStep (
110+ 	require .NoError (s .T (), s .RegisterStateFullStep (
150111		func (ctx  xcontext.Context , ch  test.TestStepChannels , params  test.TestStepParameters , ev  testevent.Emitter , resumeState  json.RawMessage ) (json.RawMessage , error ) {
151112			return  teststeps .ForEachTarget (stateFullStepName , ctx , ch , func (ctx  xcontext.Context , target  * target.Target ) error  {
152113				assert .NotNil (s .T (), target )
@@ -180,7 +141,7 @@ func (s *JobRunnerSuite) TestSimpleJobStartFinish() {
180141					TargetManager :     targetlist .New (),
181142				},
182143				TestStepsBundles : []test.TestStepBundle {
183- 					s .newStep ("test_step_label" , stateFullStepName , nil ),
144+ 					s .NewStep ("test_step_label" , stateFullStepName , nil ),
184145				},
185146			},
186147		},
@@ -209,7 +170,7 @@ func (s *JobRunnerSuite) TestJobWithTestRetry() {
209170	var  resultTargets  []* target.Target 
210171	var  callsCount  int 
211172
212- 	require .NoError (s .T (), s .registerStateFullStep (
173+ 	require .NoError (s .T (), s .RegisterStateFullStep (
213174		func (ctx  xcontext.Context , ch  test.TestStepChannels , params  test.TestStepParameters , ev  testevent.Emitter , resumeState  json.RawMessage ) (json.RawMessage , error ) {
214175			return  teststeps .ForEachTarget (stateFullStepName , ctx , ch , func (ctx  xcontext.Context , target  * target.Target ) error  {
215176				assert .NotNil (s .T (), target )
@@ -259,11 +220,11 @@ func (s *JobRunnerSuite) TestJobWithTestRetry() {
259220					TargetManager :     targetlist .New (),
260221				},
261222				TestStepsBundles : []test.TestStepBundle {
262- 					s .newStep ("echo1_step_label" , echo .Name , map [string ][]test.Param {
223+ 					s .NewStep ("echo1_step_label" , echo .Name , map [string ][]test.Param {
263224						"text" : {* test .NewParam ("hello" )},
264225					}),
265- 					s .newStep ("test_step_label" , stateFullStepName , nil ),
266- 					s .newStep ("echo2_step_label" , echo .Name , map [string ][]test.Param {
226+ 					s .NewStep ("test_step_label" , stateFullStepName , nil ),
227+ 					s .NewStep ("echo2_step_label" , echo .Name , map [string ][]test.Param {
267228						"text" : {* test .NewParam ("world" )},
268229					}),
269230				},
@@ -342,7 +303,7 @@ func (s *JobRunnerSuite) TestResumeStateBadJobId() {
342303					TargetManager :     targetlist .New (),
343304				},
344305				TestStepsBundles : []test.TestStepBundle {
345- 					s .newStep ("echo1_step_label" , echo .Name , map [string ][]test.Param {
306+ 					s .NewStep ("echo1_step_label" , echo .Name , map [string ][]test.Param {
346307						"text" : {* test .NewParam ("hello" )},
347308					}),
348309				},
0 commit comments