diff --git a/solver.go b/solver.go index bcbce2b..7b5fc61 100644 --- a/solver.go +++ b/solver.go @@ -92,10 +92,11 @@ func (s *solverWrapperImpl) Solve( startSolutions ...Solution, ) (SolutionChannel, error) { start := ctx.Value(run.Start).(time.Time) - ctx, _ = context.WithDeadline( + ctx, cancel := context.WithDeadline( ctx, start.Add(solveOptions.Duration), ) + defer cancel() interpretedSolveOptions := SolveOptions{ Iterations: solveOptions.Iterations, Duration: solveOptions.Duration, diff --git a/solver_parallel.go b/solver_parallel.go index b153238..ee84e3d 100644 --- a/solver_parallel.go +++ b/solver_parallel.go @@ -70,10 +70,11 @@ func (p *parallelSolverWrapperImpl) Solve( startSolutions ...Solution, ) (SolutionChannel, error) { start := ctx.Value(run.Start).(time.Time) - ctx, _ = context.WithDeadline( + ctx, cancel := context.WithDeadline( ctx, start.Add(solveOptions.Duration), ) + defer cancel() interpretedParallelSolveOptions := ParallelSolveOptions{ Iterations: solveOptions.Iterations, diff --git a/tests/custom_matrices/main.go b/tests/custom_matrices/main.go index a63fca9..903386b 100755 --- a/tests/custom_matrices/main.go +++ b/tests/custom_matrices/main.go @@ -8,9 +8,9 @@ import ( "github.com/nextmv-io/nextroute" "github.com/nextmv-io/nextroute/check" - "github.com/nextmv-io/nextroute/common" "github.com/nextmv-io/nextroute/factory" "github.com/nextmv-io/nextroute/schema" + "github.com/nextmv-io/sdk/common" "github.com/nextmv-io/sdk/run" runSchema "github.com/nextmv-io/sdk/run/schema" ) diff --git a/tests/golden/main_test.go b/tests/golden/main_test.go index ca882fa..1d97698 100644 --- a/tests/golden/main_test.go +++ b/tests/golden/main_test.go @@ -7,8 +7,6 @@ import ( "github.com/nextmv-io/sdk/golden" ) -const templateName = "nextroute" - func TestMain(m *testing.M) { cleanUp() golden.CopyFile("../../cmd/main.go", "main.go") diff --git a/tests/output_options/main_test.go b/tests/output_options/main_test.go index 9c8edd6..84f9f68 100644 --- a/tests/output_options/main_test.go +++ b/tests/output_options/main_test.go @@ -7,8 +7,6 @@ import ( "github.com/nextmv-io/sdk/golden" ) -const templateName = "nextroute" - func TestMain(m *testing.M) { cleanUp() golden.CopyFile("../../cmd/main.go", "main.go")