From ce4f30c5ae36013d797f5b18a6b3e03f01931f26 Mon Sep 17 00:00:00 2001 From: Matthew Hooker Date: Mon, 22 Jan 2018 16:50:14 -0800 Subject: [PATCH] fix tests --- helper/multistep/basic_runner_test.go | 14 ++++++-------- helper/multistep/debug_runner.go | 2 +- helper/multistep/debug_runner_test.go | 12 +++++------- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/helper/multistep/basic_runner_test.go b/helper/multistep/basic_runner_test.go index d13ccedf0..433f288d2 100644 --- a/helper/multistep/basic_runner_test.go +++ b/helper/multistep/basic_runner_test.go @@ -4,8 +4,6 @@ import ( "reflect" "testing" "time" - - "golang.org/x/net/context" ) func TestBasicRunner_ImplRunner(t *testing.T) { @@ -22,7 +20,7 @@ func TestBasicRunner_Run(t *testing.T) { stepB := &TestStepAcc{Data: "b"} r := &BasicRunner{Steps: []Step{stepA, stepB}} - r.Run(context.Background(), data) + r.Run(data) // Test run data expected := []string{"a", "b"} @@ -55,7 +53,7 @@ func TestBasicRunner_Run_Halt(t *testing.T) { stepC := &TestStepAcc{Data: "c"} r := &BasicRunner{Steps: []Step{stepA, stepB, stepC}} - r.Run(context.Background(), data) + r.Run(data) // Test run data expected := []string{"a", "b"} @@ -88,12 +86,12 @@ func TestBasicRunner_Run_Run(t *testing.T) { stepWait := &TestStepWaitForever{} r := &BasicRunner{Steps: []Step{stepInt, stepWait}} - go r.Run(context.Background(), new(BasicStateBag)) + go r.Run(new(BasicStateBag)) // wait until really running <-ch // now try to run aain - r.Run(context.Background(), new(BasicStateBag)) + r.Run(new(BasicStateBag)) // should not get here in nominal codepath t.Errorf("Was able to run an already running BasicRunner") @@ -112,7 +110,7 @@ func TestBasicRunner_Cancel(t *testing.T) { // cancelling an idle Runner is a no-op r.Cancel() - go r.Run(context.Background(), data) + go r.Run(data) // Wait until we reach the sync point responseCh := <-ch @@ -163,7 +161,7 @@ func TestBasicRunner_Cancel_Special(t *testing.T) { state := new(BasicStateBag) state.Put("runner", r) - r.Run(context.Background(), state) + r.Run(state) // test that state contains cancelled if _, ok := state.GetOk(StateCancelled); !ok { diff --git a/helper/multistep/debug_runner.go b/helper/multistep/debug_runner.go index 88af01c54..83dbe57e2 100644 --- a/helper/multistep/debug_runner.go +++ b/helper/multistep/debug_runner.go @@ -1,8 +1,8 @@ package multistep import ( - "context" "fmt" + "golang.org/x/net/context" "reflect" "sync" ) diff --git a/helper/multistep/debug_runner_test.go b/helper/multistep/debug_runner_test.go index 78ce70a88..aae905d43 100644 --- a/helper/multistep/debug_runner_test.go +++ b/helper/multistep/debug_runner_test.go @@ -5,8 +5,6 @@ import ( "reflect" "testing" "time" - - "golang.org/x/net/context" ) func TestDebugRunner_Impl(t *testing.T) { @@ -41,7 +39,7 @@ func TestDebugRunner_Run(t *testing.T) { PauseFn: pauseFn, } - r.Run(context.Background(), data) + r.Run(data) // Test data expected := []string{"a", "TestStepAcc", "b", "TestStepAcc"} @@ -68,12 +66,12 @@ func TestDebugRunner_Run_Run(t *testing.T) { stepWait := &TestStepWaitForever{} r := &DebugRunner{Steps: []Step{stepInt, stepWait}} - go r.Run(context.Background(), new(BasicStateBag)) + go r.Run(new(BasicStateBag)) // wait until really running <-ch // now try to run aain - r.Run(context.Background(), new(BasicStateBag)) + r.Run(new(BasicStateBag)) // should not get here in nominal codepath t.Errorf("Was able to run an already running DebugRunner") @@ -93,7 +91,7 @@ func TestDebugRunner_Cancel(t *testing.T) { // cancelling an idle Runner is a no-op r.Cancel() - go r.Run(context.Background(), data) + go r.Run(data) // Wait until we reach the sync point responseCh := <-ch @@ -156,7 +154,7 @@ func TestDebugPauseDefault(t *testing.T) { dr := &DebugRunner{Steps: []Step{ &TestStepAcc{Data: "a"}, }} - dr.Run(context.Background(), new(BasicStateBag)) + dr.Run(new(BasicStateBag)) complete <- true }()