wire: speed up test execution (google/go-cloud#163)
1. Runs subtests in parallel. 2. Decreases the number of runs of the Determinism test to a constant 2.
This commit is contained in:
@@ -68,6 +68,7 @@ func TestWire(t *testing.T) {
|
|||||||
}
|
}
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
bctx := test.buildContext()
|
bctx := test.buildContext()
|
||||||
gen, errs := Generate(bctx, wd, test.pkg)
|
gen, errs := Generate(bctx, wd, test.pkg)
|
||||||
if len(gen) > 0 {
|
if len(gen) > 0 {
|
||||||
@@ -131,15 +132,13 @@ func TestWire(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
t.Run("Determinism", func(t *testing.T) {
|
t.Run("Determinism", func(t *testing.T) {
|
||||||
runs := 10
|
const runs = 2
|
||||||
if testing.Short() {
|
|
||||||
runs = 3
|
|
||||||
}
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
if test.wantError {
|
if test.wantError {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
bctx := test.buildContext()
|
bctx := test.buildContext()
|
||||||
gold, errs := Generate(bctx, wd, test.pkg)
|
gold, errs := Generate(bctx, wd, test.pkg)
|
||||||
if len(errs) > 0 {
|
if len(errs) > 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user