From 98f1d993d0ba08761c892fce0dc6d5b22b73f595 Mon Sep 17 00:00:00 2001 From: sam boyer Date: Wed, 19 Jul 2017 23:28:48 -0400 Subject: [PATCH] Fully embrace subtests; remove hacky targeting arg --- internal/gps/solve_test.go | 66 +++++++++++++------------------------- txn_writer.go | 3 +- 2 files changed, 25 insertions(+), 44 deletions(-) diff --git a/internal/gps/solve_test.go b/internal/gps/solve_test.go index b2ccc087d3..cf2363d80d 100644 --- a/internal/gps/solve_test.go +++ b/internal/gps/solve_test.go @@ -6,7 +6,6 @@ package gps import ( "bytes" - "flag" "fmt" "io/ioutil" "log" @@ -21,13 +20,6 @@ import ( "github.com/golang/dep/internal/gps/pkgtree" ) -var fixtorun string - -// TODO(sdboyer) regression test ensuring that locks with only revs for projects don't cause errors -func init() { - flag.StringVar(&fixtorun, "gps.fix", "", "A single fixture to run in TestBasicSolves or TestBimodalSolves") -} - // overrideMkBridge overrides the base bridge with the depspecBridge that skips // verifyRootDir calls func overrideMkBridge(s *solver, sm SourceManager, down bool) sourceBridge { @@ -74,24 +66,18 @@ func fixSolve(params SolveParameters, sm SourceManager, t *testing.T) (Solution, // // Or, just the one named in the fix arg. func TestBasicSolves(t *testing.T) { - if fixtorun != "" { - if fix, exists := basicFixtures[fixtorun]; exists { - solveBasicsAndCheck(fix, t) - } - } else { - // sort them by their keys so we get stable output - var names []string - for n := range basicFixtures { - names = append(names, n) - } + // sort them by their keys so we get stable output + names := make([]string, 0, len(basicFixtures)) + for n := range basicFixtures { + names = append(names, n) + } - sort.Strings(names) - for _, n := range names { - t.Run(n, func(t *testing.T) { - //t.Parallel() // until trace output is fixed in parallel - solveBasicsAndCheck(basicFixtures[n], t) - }) - } + sort.Strings(names) + for _, n := range names { + t.Run(n, func(t *testing.T) { + t.Parallel() + solveBasicsAndCheck(basicFixtures[n], t) + }) } } @@ -122,24 +108,18 @@ func solveBasicsAndCheck(fix basicFixture, t *testing.T) (res Solution, err erro // // Or, just the one named in the fix arg. func TestBimodalSolves(t *testing.T) { - if fixtorun != "" { - if fix, exists := bimodalFixtures[fixtorun]; exists { - solveBimodalAndCheck(fix, t) - } - } else { - // sort them by their keys so we get stable output - var names []string - for n := range bimodalFixtures { - names = append(names, n) - } - - sort.Strings(names) - for _, n := range names { - t.Run(n, func(t *testing.T) { - //t.Parallel() // until trace output is fixed in parallel - solveBimodalAndCheck(bimodalFixtures[n], t) - }) - } + // sort them by their keys so we get stable output + names := make([]string, 0, len(bimodalFixtures)) + for n := range bimodalFixtures { + names = append(names, n) + } + + sort.Strings(names) + for _, n := range names { + t.Run(n, func(t *testing.T) { + t.Parallel() + solveBimodalAndCheck(bimodalFixtures[n], t) + }) } } diff --git a/txn_writer.go b/txn_writer.go index 7d2d04de6e..69f859f833 100644 --- a/txn_writer.go +++ b/txn_writer.go @@ -63,7 +63,8 @@ type SafeWriter struct { writeVendor bool } -// NewSafeWriter sets up a SafeWriter to write a set of config yaml, lock and vendor tree. +// NewSafeWriter sets up a SafeWriter to write a set of manifest, lock, and +// vendor tree. // // - If manifest is provided, it will be written to the standard manifest file // name beneath root.