Skip to content

Commit

Permalink
yaml: deflake pool_test
Browse files Browse the repository at this point in the history
Signed-off-by: Sugu Sougoumarane <[email protected]>
  • Loading branch information
sougou committed Apr 19, 2020
1 parent 8f93fc4 commit 25af6e7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions go/vt/vttablet/tabletserver/connpool/pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package connpool

import (
"runtime"
"sync"
"testing"
"time"

Expand Down Expand Up @@ -80,7 +81,10 @@ func TestConnPoolMaxWaiters(t *testing.T) {
require.NoError(t, err)

// waiter 1
var wg sync.WaitGroup
wg.Add(1)
go func() {
defer wg.Done()
c1, err := connPool.Get(context.Background())
assert.NoError(t, err)
c1.Recycle()
Expand All @@ -92,11 +96,14 @@ func TestConnPoolMaxWaiters(t *testing.T) {
break
}
}

// waiter 2
_, err = connPool.Get(context.Background())
assert.EqualError(t, err, "pool TestPool waiter count exceeded")

// This recycle will make waiter1 succeed.
dbConn.Recycle()
wg.Wait()
}

func TestConnPoolGetEmptyDebugConfig(t *testing.T) {
Expand Down

0 comments on commit 25af6e7

Please sign in to comment.