Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

Commit df32e15

Browse files
authored
Merge pull request #1301 from jmank88/par_tests
gps: parallelize many tests
2 parents 59b9d9f + f3af4c0 commit df32e15

5 files changed

+17
-0
lines changed

internal/gps/manager_test.go

+9
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ func TestSourceInit(t *testing.T) {
139139
if testing.Short() {
140140
t.Skip("Skipping project manager init test in short mode")
141141
}
142+
t.Parallel()
142143

143144
cpath, err := ioutil.TempDir("", "smcache")
144145
if err != nil {
@@ -280,6 +281,7 @@ func TestDefaultBranchAssignment(t *testing.T) {
280281
if testing.Short() {
281282
t.Skip("Skipping default branch assignment test in short mode")
282283
}
284+
t.Parallel()
283285

284286
sm, clean := mkNaiveSM(t)
285287
defer clean()
@@ -405,6 +407,7 @@ func TestSourceCreationCounts(t *testing.T) {
405407
if testing.Short() {
406408
t.Skip("Skipping slow test in short mode")
407409
}
410+
t.Parallel()
408411

409412
fixtures := map[string]sourceCreationTestFixture{
410413
"gopkgin uniqueness": {
@@ -447,6 +450,7 @@ func TestGetSources(t *testing.T) {
447450
if testing.Short() {
448451
t.Skip("Skipping source setup test in short mode")
449452
}
453+
t.Parallel()
450454
requiresBins(t, "git", "hg", "bzr")
451455

452456
sm, clean := mkNaiveSM(t)
@@ -513,6 +517,7 @@ func TestFSCaseSensitivityConvergesSources(t *testing.T) {
513517
if testing.Short() {
514518
t.Skip("Skipping slow test in short mode")
515519
}
520+
t.Parallel()
516521

517522
f := func(name string, pi1, pi2 ProjectIdentifier) {
518523
t.Run(name, func(t *testing.T) {
@@ -571,6 +576,7 @@ func TestGetInfoListVersionsOrdering(t *testing.T) {
571576
if testing.Short() {
572577
t.Skip("Skipping slow test in short mode")
573578
}
579+
t.Parallel()
574580

575581
sm, clean := mkNaiveSM(t)
576582
defer clean()
@@ -675,6 +681,7 @@ func TestMultiFetchThreadsafe(t *testing.T) {
675681
if testing.Short() {
676682
t.Skip("Skipping slow test in short mode")
677683
}
684+
t.Parallel()
678685

679686
projects := []ProjectIdentifier{
680687
mkPI("github.com/sdboyer/gps"),
@@ -782,6 +789,7 @@ func TestListVersionsRacey(t *testing.T) {
782789
if testing.Short() {
783790
t.Skip("Skipping slow test in short mode")
784791
}
792+
t.Parallel()
785793

786794
sm, clean := mkNaiveSM(t)
787795
defer clean()
@@ -937,6 +945,7 @@ func TestUnreachableSource(t *testing.T) {
937945
if testing.Short() {
938946
t.Skip("Skipping slow test in short mode")
939947
}
948+
t.Parallel()
940949

941950
sm, clean := mkNaiveSM(t)
942951
defer clean()

internal/gps/source_cache_bolt_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import (
1515
)
1616

1717
func TestBoltCacheTimeout(t *testing.T) {
18+
t.Parallel()
19+
1820
const root = "example.com/test"
1921
cpath, err := ioutil.TempDir("", "singlesourcecache")
2022
if err != nil {

internal/gps/source_cache_test.go

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import (
1818
)
1919

2020
func Test_singleSourceCache(t *testing.T) {
21+
t.Parallel()
22+
2123
newMem := func(*testing.T, string, string) (singleSourceCache, func() error) {
2224
return newMemoryCache(), func() error { return nil }
2325
}
@@ -70,6 +72,8 @@ type singleSourceCacheTest struct {
7072
// run tests singleSourceCache methods of caches returned by test.newCache.
7173
// For test.persistent caches, test.newCache is periodically called mid-test to ensure persistence.
7274
func (test singleSourceCacheTest) run(t *testing.T) {
75+
t.Parallel()
76+
7377
const root = "example.com/test"
7478
cpath, err := ioutil.TempDir("", "singlesourcecache")
7579
if err != nil {

internal/gps/vcs_source_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121

2222
// Parent test that executes all the slow vcs interaction tests in parallel.
2323
func TestSlowVcs(t *testing.T) {
24+
t.Parallel()
2425
t.Run("write-deptree", testWriteDepTree)
2526
t.Run("source-gateway", testSourceGateway)
2627
t.Run("bzr-repo", testBzrRepo)

internal/gps/vcs_version_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ func TestVCSVersion(t *testing.T) {
1717
}
1818

1919
h := test.NewHelper(t)
20+
h.Parallel()
2021
defer h.Cleanup()
2122
requiresBins(t, "git")
2223

0 commit comments

Comments
 (0)