Reduce Mutex test runs (#9345)

Some tests take a long time on CI:

* `--- PASS: TestRWMutex (226.49s)`
* ` --- PASS: TestRWMutex (7.13s)`

Reduce the number of runs.

Before/after locally:

```
--- PASS: TestRWMutex (20.95s)
--- PASS: TestRWMutex (7.13s)

--- PASS: TestMutex (3.01s)
--- PASS: TestMutex (1.65s)
```
master
Klaus Post 5 years ago committed by GitHub
parent f19cbfad5c
commit 6a8298b137
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      pkg/dsync/drwmutex_test.go
  2. 6
      pkg/dsync/dsync_test.go

@ -240,7 +240,7 @@ func HammerRWMutex(gomaxprocs, numReaders, numIterations int) {
// Borrowed from rwmutex_test.go // Borrowed from rwmutex_test.go
func TestRWMutex(t *testing.T) { func TestRWMutex(t *testing.T) {
defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(-1)) defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(-1))
n := 1000 n := 100
if testing.Short() { if testing.Short() {
n = 5 n = 5
} }

@ -242,10 +242,14 @@ func HammerMutex(m *DRWMutex, loops int, cdone chan bool) {
// Borrowed from mutex_test.go // Borrowed from mutex_test.go
func TestMutex(t *testing.T) { func TestMutex(t *testing.T) {
loops := 200
if testing.Short() {
loops = 5
}
c := make(chan bool) c := make(chan bool)
m := NewDRWMutex(context.Background(), ds, "test") m := NewDRWMutex(context.Background(), ds, "test")
for i := 0; i < 10; i++ { for i := 0; i < 10; i++ {
go HammerMutex(m, 1000, c) go HammerMutex(m, loops, c)
} }
for i := 0; i < 10; i++ { for i := 0; i < 10; i++ {
<-c <-c

Loading…
Cancel
Save