Skip to content

Commit d6d48ae

Browse files
committed
Add support for intra-step pause
If asked to pause, a step can return ErrPaused with a piece of state that will be passed to a new instance when the job is resumed. The state is opaque but at a minimum should contain targets that were in flight at the time, they will not be reinjected and runner will expect results for them when the job is resumed. Handling pause is not a requirement, a step can completely ignore the pause signal and pausing will still work between steps.
1 parent 11ef575 commit d6d48ae

25 files changed

Lines changed: 394 additions & 149 deletions

File tree

cmds/plugins/plugins.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
"github.com/facebookincubator/contest/plugins/teststeps/echo"
2828
"github.com/facebookincubator/contest/plugins/teststeps/example"
2929
"github.com/facebookincubator/contest/plugins/teststeps/randecho"
30+
"github.com/facebookincubator/contest/plugins/teststeps/sleep"
3031
"github.com/facebookincubator/contest/plugins/teststeps/sshcmd"
3132
)
3233

@@ -41,11 +42,12 @@ var testFetchers = []test.TestFetcherLoader{
4142
}
4243

4344
var testSteps = []test.TestStepLoader{
45+
cmd.Load,
4446
echo.Load,
4547
example.Load,
46-
cmd.Load,
47-
sshcmd.Load,
4848
randecho.Load,
49+
sleep.Load,
50+
sshcmd.Load,
4951
}
5052

5153
var reporters = []job.ReporterLoader{

pkg/pluginregistry/pluginregistry_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
package pluginregistry
77

88
import (
9+
"encoding/json"
910
"testing"
1011

1112
"github.com/facebookincubator/contest/pkg/event"
@@ -43,8 +44,8 @@ func (e AStep) Name() string {
4344
}
4445

4546
// Run executes the AStep
46-
func (e AStep) Run(ctx xcontext.Context, ch test.TestStepChannels, params test.TestStepParameters, ev testevent.Emitter) error {
47-
return nil
47+
func (e AStep) Run(ctx xcontext.Context, ch test.TestStepChannels, params test.TestStepParameters, ev testevent.Emitter, resumeState json.RawMessage) (json.RawMessage, error) {
48+
return nil, nil
4849
}
4950

5051
func TestRegisterTestStep(t *testing.T) {

0 commit comments

Comments
 (0)