Skip to content

Commit 78baa5e

Browse files
author
Yiran Wang
authored
Reduce number of goroutines in tests that became flaky after Go 1.14 migration (#248)
* Run less go routines in unit tests * Change number * Change number
1 parent e95dce8 commit 78baa5e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/persistedretry/tagreplication/store_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ import (
2121
"github.com/golang/mock/gomock"
2222
"github.com/jmoiron/sqlx"
2323

24+
"github.com/stretchr/testify/require"
2425
"github.com/uber/kraken/lib/persistedretry"
2526
. "github.com/uber/kraken/lib/persistedretry/tagreplication"
2627
"github.com/uber/kraken/localdb"
27-
"github.com/uber/kraken/mocks/lib/persistedretry/tagreplication"
28+
mocktagreplication "github.com/uber/kraken/mocks/lib/persistedretry/tagreplication"
2829
"github.com/uber/kraken/utils/testutil"
29-
"github.com/stretchr/testify/require"
3030
)
3131

3232
type storeMocks struct {
@@ -109,7 +109,7 @@ func TestDatabaseNotLocked(t *testing.T) {
109109
store := mocks.new()
110110

111111
var wg sync.WaitGroup
112-
for i := 0; i < 1000; i++ {
112+
for i := 0; i < 200; i++ {
113113
wg.Add(1)
114114
go func() {
115115
defer wg.Done()

lib/persistedretry/writeback/store_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ import (
1818
"testing"
1919
"time"
2020

21+
"github.com/stretchr/testify/require"
2122
"github.com/uber/kraken/lib/persistedretry"
2223
"github.com/uber/kraken/localdb"
23-
"github.com/stretchr/testify/require"
2424
)
2525

2626
func checkTask(t *testing.T, expected *Task, result persistedretry.Task) {
@@ -75,7 +75,7 @@ func TestDatabaseNotLocked(t *testing.T) {
7575
store := NewStore(db)
7676

7777
var wg sync.WaitGroup
78-
for i := 0; i < 1000; i++ {
78+
for i := 0; i < 200; i++ {
7979
wg.Add(1)
8080
go func() {
8181
defer wg.Done()

0 commit comments

Comments
 (0)