Speed up concurrency tests

This commit is contained in:
Maurizio Porrato 2021-05-17 16:57:55 +01:00
parent aaf57943fc
commit e99ccdab9c
Signed by: guru
GPG Key ID: C622977DF024AC24
1 changed files with 3 additions and 4 deletions

View File

@ -109,7 +109,7 @@ func testStoreConcurrencyWorker(wg *sync.WaitGroup, t *testing.T, store *Store,
if err == nil { if err == nil {
break break
} else { } else {
time.Sleep(time.Duration(10000 * (rand.Int31()%300 + 10))) time.Sleep(time.Duration(1000 * (rand.Int31()%20 + 5)))
} }
} }
} }
@ -121,8 +121,7 @@ func testStoreConcurrencyHelper(t *testing.T, drv StoreDriver, workers, rounds i
s, err := store.Create("0.1.2") s, err := store.Create("0.1.2")
if err != nil { if err != nil {
t.Error("Create() failed") t.Fatal("Create() failed")
return
} }
wg.Add(workers) wg.Add(workers)
for i := 0; i < workers; i++ { for i := 0; i < workers; i++ {
@ -145,7 +144,7 @@ func testStoreConcurrencyHelper(t *testing.T, drv StoreDriver, workers, rounds i
func TestStore_Concurrency_Mem(t *testing.T) { func TestStore_Concurrency_Mem(t *testing.T) {
drv, _ := NewMemStore() drv, _ := NewMemStore()
testStoreConcurrencyHelper(t, drv, 5, 50000) testStoreConcurrencyHelper(t, drv, 5, 40000)
} }
func TestStore_Concurrency_FS(t *testing.T) { func TestStore_Concurrency_FS(t *testing.T) {