-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pass a runtime to the test runner (#1010)
- Loading branch information
Showing
3 changed files
with
26 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,7 @@ func TestRunner(t *testing.T) { | |
helper := &testHelper{t: t} | ||
workflow := createBasicTestWorkflow(helper.transformTrigger) | ||
|
||
runner := testutils.NewRunner(tests.Context(t)) | ||
runner := testutils.NewRunner(tests.Context(t), &testutils.NoopRuntime{}) | ||
|
||
triggerMock, actionMock, consensusMock, targetMock := setupAllRunnerMocks(t, runner) | ||
|
||
|
@@ -92,7 +92,7 @@ func TestRunner(t *testing.T) { | |
Schedule: "oneAtATime", | ||
}.New(workflow, "[email protected]", chainwriter.TargetInput{SignedReport: consensus}) | ||
|
||
runner := testutils.NewRunner(tests.Context(t)) | ||
runner := testutils.NewRunner(tests.Context(t), &testutils.NoopRuntime{}) | ||
_, _, _, targetMock := setupAllRunnerMocks(t, runner) | ||
|
||
runner.Run(workflow) | ||
|
@@ -104,7 +104,7 @@ func TestRunner(t *testing.T) { | |
t.Run("Run returns errors if capabilities were registered multiple times", func(t *testing.T) { | ||
helper := &testHelper{t: t} | ||
workflow := createBasicTestWorkflow(helper.transformTrigger) | ||
runner := testutils.NewRunner(tests.Context(t)) | ||
runner := testutils.NewRunner(tests.Context(t), &testutils.NoopRuntime{}) | ||
setupAllRunnerMocks(t, runner) | ||
setupAllRunnerMocks(t, runner) | ||
|
||
|
@@ -118,7 +118,7 @@ func TestRunner(t *testing.T) { | |
return false, expectedErr | ||
}) | ||
|
||
runner := testutils.NewRunner(tests.Context(t)) | ||
runner := testutils.NewRunner(tests.Context(t), &testutils.NoopRuntime{}) | ||
|
||
basictriggertest.Trigger(runner, func() (basictrigger.TriggerOutputs, error) { | ||
return basictrigger.TriggerOutputs{CoolOutput: "cool"}, nil | ||
|
@@ -141,7 +141,7 @@ func TestRunner(t *testing.T) { | |
helper := &testHelper{t: t} | ||
workflow := createBasicTestWorkflow(helper.transformTrigger) | ||
|
||
runner := testutils.NewRunner(tests.Context(t)) | ||
runner := testutils.NewRunner(tests.Context(t), &testutils.NoopRuntime{}) | ||
|
||
basictriggertest.Trigger(runner, func() (basictrigger.TriggerOutputs, error) { | ||
return basictrigger.TriggerOutputs{CoolOutput: "cool"}, nil | ||
|
@@ -159,7 +159,7 @@ func TestRunner(t *testing.T) { | |
}) | ||
|
||
t.Run("Run registers and unregisters from capabilities", func(t *testing.T) { | ||
runner := testutils.NewRunner(tests.Context(t)) | ||
runner := testutils.NewRunner(tests.Context(t), &testutils.NoopRuntime{}) | ||
|
||
workflow, testTriggerConfig, testTargetConfig := registrationWorkflow() | ||
|
||
|
@@ -178,7 +178,7 @@ func TestRunner(t *testing.T) { | |
}) | ||
|
||
t.Run("Run captures register errors", func(t *testing.T) { | ||
runner := testutils.NewRunner(tests.Context(t)) | ||
runner := testutils.NewRunner(tests.Context(t), &testutils.NoopRuntime{}) | ||
|
||
workflow, _, _ := registrationWorkflow() | ||
|
||
|
@@ -196,7 +196,7 @@ func TestRunner(t *testing.T) { | |
}) | ||
|
||
t.Run("Run captures unregister errors", func(t *testing.T) { | ||
runner := testutils.NewRunner(tests.Context(t)) | ||
runner := testutils.NewRunner(tests.Context(t), &testutils.NoopRuntime{}) | ||
|
||
workflow, _, _ := registrationWorkflow() | ||
|
||
|
@@ -214,7 +214,7 @@ func TestRunner(t *testing.T) { | |
}) | ||
|
||
t.Run("GetRegisteredMock returns the mock for a step", func(t *testing.T) { | ||
runner := testutils.NewRunner(tests.Context(t)) | ||
runner := testutils.NewRunner(tests.Context(t), &testutils.NoopRuntime{}) | ||
expected := basicactiontest.ActionForStep(runner, "action", func(input basicaction.ActionInputs) (basicaction.ActionOutputs, error) { | ||
return basicaction.ActionOutputs{}, nil | ||
}) | ||
|
@@ -229,7 +229,7 @@ func TestRunner(t *testing.T) { | |
}) | ||
|
||
t.Run("GetRegisteredMock returns a default mock if step wasn't specified", func(t *testing.T) { | ||
runner := testutils.NewRunner(tests.Context(t)) | ||
runner := testutils.NewRunner(tests.Context(t), &testutils.NoopRuntime{}) | ||
expected := basicactiontest.Action(runner, func(input basicaction.ActionInputs) (basicaction.ActionOutputs, error) { | ||
return basicaction.ActionOutputs{}, nil | ||
}) | ||
|
@@ -238,15 +238,15 @@ func TestRunner(t *testing.T) { | |
}) | ||
|
||
t.Run("GetRegisteredMock returns nil if no mock was registered", func(t *testing.T) { | ||
runner := testutils.NewRunner(tests.Context(t)) | ||
runner := testutils.NewRunner(tests.Context(t), &testutils.NoopRuntime{}) | ||
referenceactiontest.Action(runner, func(input referenceaction.SomeInputs) (referenceaction.SomeOutputs, error) { | ||
return referenceaction.SomeOutputs{}, nil | ||
}) | ||
assert.Nil(t, runner.GetRegisteredMock("[email protected]", "action")) | ||
}) | ||
|
||
t.Run("GetRegisteredMock returns nil if no mock was registered for a step", func(t *testing.T) { | ||
runner := testutils.NewRunner(tests.Context(t)) | ||
runner := testutils.NewRunner(tests.Context(t), &testutils.NoopRuntime{}) | ||
differentStep := basicactiontest.ActionForStep(runner, "step", func(input basicaction.ActionInputs) (basicaction.ActionOutputs, error) { | ||
return basicaction.ActionOutputs{}, nil | ||
}) | ||
|
@@ -281,7 +281,7 @@ func TestCompute(t *testing.T) { | |
return actual, nil | ||
}) | ||
|
||
runner := testutils.NewRunner(tests.Context(t)) | ||
runner := testutils.NewRunner(tests.Context(t), &testutils.NoopRuntime{}) | ||
basictriggertest.Trigger(runner, func() (basictrigger.TriggerOutputs, error) { | ||
return basictrigger.TriggerOutputs{CoolOutput: "100"}, nil | ||
}) | ||
|
@@ -304,7 +304,7 @@ func TestCompute(t *testing.T) { | |
return c, nil | ||
}) | ||
|
||
runner := testutils.NewRunner(tests.Context(t)) | ||
runner := testutils.NewRunner(tests.Context(t), &testutils.NoopRuntime{}) | ||
secretToken := "superSuperSecretToken" | ||
runner.Secrets = map[string]string{ | ||
"fidelity": secretToken, | ||
|