@@ -156,7 +156,7 @@ func TestNewBigtableChannelPoolEdgeCases(t *testing.T) {
156156
157157 for _ , tc := range tests {
158158 t .Run (tc .name , func (t * testing.T ) {
159- pool , err := NewBigtableChannelPool (ctx , tc .size , btopt .RoundRobin , tc .dial , poolOpts ()... )
159+ pool , err := NewBigtableChannelPool (ctx , tc .size , btopt .RoundRobin , tc .dial , time . Now (), poolOpts ()... )
160160 if tc .wantErr {
161161 if err == nil {
162162 t .Errorf ("NewBigtableChannelPool(%d) succeeded, want error containing %q" , tc .size , tc .errMatch )
@@ -331,7 +331,7 @@ func TestPoolInvoke(t *testing.T) {
331331 addr := setupTestServer (t , fake )
332332 dialFunc := func () (* BigtableConn , error ) { return dialBigtableserver (addr ) }
333333
334- pool , err := NewBigtableChannelPool (ctx , poolSize , strategy , dialFunc , poolOpts ()... )
334+ pool , err := NewBigtableChannelPool (ctx , poolSize , strategy , dialFunc , time . Now (), poolOpts ()... )
335335 if err != nil {
336336 t .Fatalf ("Failed to create pool: %v" , err )
337337 }
@@ -403,7 +403,7 @@ func TestPoolNewStream(t *testing.T) {
403403 addr := setupTestServer (t , fake )
404404 dialFunc := func () (* BigtableConn , error ) { return dialBigtableserver (addr ) }
405405
406- pool , err := NewBigtableChannelPool (ctx , poolSize , strategy , dialFunc , poolOpts ()... )
406+ pool , err := NewBigtableChannelPool (ctx , poolSize , strategy , dialFunc , time . Now (), poolOpts ()... )
407407 if err != nil {
408408 t .Fatalf ("Failed to create pool: %v" , err )
409409 }
@@ -467,7 +467,7 @@ func TestPoolNewStream(t *testing.T) {
467467 fake := & fakeService {}
468468 addr := setupTestServer (t , fake )
469469 dialFunc := func () (* BigtableConn , error ) { return dialBigtableserver (addr ) }
470- pool , err := NewBigtableChannelPool (ctx , poolSize , btopt .RoundRobin , dialFunc , poolOpts ()... )
470+ pool , err := NewBigtableChannelPool (ctx , poolSize , btopt .RoundRobin , dialFunc , time . Now (), poolOpts ()... )
471471 if err != nil {
472472 t .Fatalf ("Failed to create pool: %v" , err )
473473 }
@@ -518,7 +518,7 @@ func TestNewBigtableChannelPool(t *testing.T) {
518518 addr := setupTestServer (t , fake )
519519 dialFunc := func () (* BigtableConn , error ) { return dialBigtableserver (addr ) }
520520
521- pool , err := NewBigtableChannelPool (ctx , poolSize , btopt .LeastInFlight , dialFunc , poolOpts ()... )
521+ pool , err := NewBigtableChannelPool (ctx , poolSize , btopt .LeastInFlight , dialFunc , time . Now (), poolOpts ()... )
522522 if err != nil {
523523 t .Fatalf ("NewBigtableChannelPool failed: %v" , err )
524524 }
@@ -565,7 +565,7 @@ func TestNewBigtableChannelPool(t *testing.T) {
565565 return dialBigtableserver (addr )
566566 }
567567
568- _ , err := NewBigtableChannelPool (ctx , poolSize , btopt .LeastInFlight , dialFunc , poolOpts ()... )
568+ _ , err := NewBigtableChannelPool (ctx , poolSize , btopt .LeastInFlight , dialFunc , time . Now (), poolOpts ()... )
569569 if err == nil {
570570 t .Errorf ("NewBigtableChannelPool should have failed due to dial error" )
571571 }
@@ -671,7 +671,7 @@ func TestCachingStreamDecrement(t *testing.T) {
671671 addr := setupTestServer (t , fake )
672672 dialFunc := func () (* BigtableConn , error ) { return dialBigtableserver (addr ) }
673673
674- pool , err := NewBigtableChannelPool (ctx , poolSize , btopt .LeastInFlight , dialFunc , poolOpts ()... )
674+ pool , err := NewBigtableChannelPool (ctx , poolSize , btopt .LeastInFlight , dialFunc , time . Now (), poolOpts ()... )
675675 if err != nil {
676676 t .Fatalf ("Failed to create pool: %v" , err )
677677 }
@@ -775,7 +775,7 @@ func TestMultipleStreamsSingleConn(t *testing.T) {
775775 addr := setupTestServer (t , fake )
776776 dialFunc := func () (* BigtableConn , error ) { return dialBigtableserver (addr ) }
777777
778- pool , err := NewBigtableChannelPool (ctx , poolSize , btopt .LeastInFlight , dialFunc , poolOpts ()... )
778+ pool , err := NewBigtableChannelPool (ctx , poolSize , btopt .LeastInFlight , dialFunc , time . Now (), poolOpts ()... )
779779 if err != nil {
780780 t .Fatalf ("Failed to create pool: %v" , err )
781781 }
@@ -850,7 +850,7 @@ func TestPoolClose(t *testing.T) {
850850 fake := & fakeService {}
851851 addr := setupTestServer (t , fake )
852852 dialFunc := func () (* BigtableConn , error ) { return dialBigtableserver (addr ) }
853- pool , err := NewBigtableChannelPool (ctx , poolSize , btopt .LeastInFlight , dialFunc , poolOpts ()... )
853+ pool , err := NewBigtableChannelPool (ctx , poolSize , btopt .LeastInFlight , dialFunc , time . Now (), poolOpts ()... )
854854 if err != nil {
855855 t .Fatalf ("Failed to create pool: %v" , err )
856856 }
@@ -873,7 +873,7 @@ func TestGracefulDraining(t *testing.T) {
873873 dialFunc := func () (* BigtableConn , error ) { return dialBigtableserver (addr ) }
874874
875875 t .Run ("DrainingOnReplaceConnection" , func (t * testing.T ) {
876- pool , err := NewBigtableChannelPool (ctx , 1 , btopt .RoundRobin , dialFunc , poolOpts ()... )
876+ pool , err := NewBigtableChannelPool (ctx , 1 , btopt .RoundRobin , dialFunc , time . Now (), poolOpts ()... )
877877 if err != nil {
878878 t .Fatalf ("Failed to create pool: %v" , err )
879879 }
@@ -941,7 +941,7 @@ func TestGracefulDraining(t *testing.T) {
941941 })
942942
943943 t .Run ("SelectionSkipsDrainingConns" , func (t * testing.T ) {
944- pool , err := NewBigtableChannelPool (ctx , 3 , btopt .RoundRobin , dialFunc , poolOpts ()... )
944+ pool , err := NewBigtableChannelPool (ctx , 3 , btopt .RoundRobin , dialFunc , time . Now (), poolOpts ()... )
945945 if err != nil {
946946 t .Fatalf ("Failed to create pool: %v" , err )
947947 }
@@ -978,7 +978,7 @@ func TestGracefulDraining(t *testing.T) {
978978 maxDrainingTimeout = 100 * time .Millisecond
979979 defer func () { maxDrainingTimeout = originalTimeout }()
980980
981- pool , err := NewBigtableChannelPool (ctx , 1 , btopt .RoundRobin , dialFunc , poolOpts ()... )
981+ pool , err := NewBigtableChannelPool (ctx , 1 , btopt .RoundRobin , dialFunc , time . Now (), poolOpts ()... )
982982 if err != nil {
983983 t .Fatalf ("Failed to create pool: %v" , err )
984984 }
@@ -1037,7 +1037,7 @@ func TestReplaceConnection(t *testing.T) {
10371037 mu .Unlock ()
10381038 atomic .StoreInt32 (& dialCount , 0 )
10391039
1040- pool , err := NewBigtableChannelPool (ctx , 2 , btopt .RoundRobin , dialFunc , poolOpts ()... )
1040+ pool , err := NewBigtableChannelPool (ctx , 2 , btopt .RoundRobin , dialFunc , time . Now (), poolOpts ()... )
10411041 if err != nil {
10421042 t .Fatalf ("Failed to create pool: %v" , err )
10431043 }
@@ -1071,7 +1071,7 @@ func TestReplaceConnection(t *testing.T) {
10711071 mu .Unlock ()
10721072 atomic .StoreInt32 (& dialCount , 0 )
10731073
1074- pool , err := NewBigtableChannelPool (ctx , 2 , btopt .RoundRobin , dialFunc , poolOpts ()... )
1074+ pool , err := NewBigtableChannelPool (ctx , 2 , btopt .RoundRobin , dialFunc , time . Now (), poolOpts ()... )
10751075 if err != nil {
10761076 t .Fatalf ("Failed to create pool: %v" , err )
10771077 }
@@ -1100,7 +1100,7 @@ func TestReplaceConnection(t *testing.T) {
11001100 mu .Unlock ()
11011101 atomic .StoreInt32 (& dialCount , 0 )
11021102
1103- poolCancelled , err := NewBigtableChannelPool (ctx , 2 , btopt .RoundRobin , dialFunc , poolOpts ()... )
1103+ poolCancelled , err := NewBigtableChannelPool (ctx , 2 , btopt .RoundRobin , dialFunc , time . Now (), poolOpts ()... )
11041104 if err != nil {
11051105 t .Fatalf ("Failed to create poolCancelled: %v" , err )
11061106 }
@@ -1130,7 +1130,7 @@ func TestReplaceConnection(t *testing.T) {
11301130 fake .setPingErr (pingErr )
11311131 atomic .StoreInt32 (& dialCount , 0 )
11321132
1133- pool , err := NewBigtableChannelPool (ctx , 2 , btopt .RoundRobin , dialFunc , poolOpts ()... )
1133+ pool , err := NewBigtableChannelPool (ctx , 2 , btopt .RoundRobin , dialFunc , time . Now (), poolOpts ()... )
11341134 if err != nil {
11351135 t .Fatalf ("Failed to create pool: %v" , err )
11361136 }
@@ -1250,7 +1250,7 @@ func TestAddConnections(t *testing.T) {
12501250 innerCtx , cancel := context .WithCancel (ctx )
12511251 defer cancel ()
12521252
1253- pool , err := NewBigtableChannelPool (innerCtx , tc .initialSize , btopt .RoundRobin , baseDialFunc , poolOpts ()... )
1253+ pool , err := NewBigtableChannelPool (innerCtx , tc .initialSize , btopt .RoundRobin , baseDialFunc , time . Now (), poolOpts ()... )
12541254 if err != nil {
12551255 t .Fatalf ("Failed to create pool: %v" , err )
12561256 }
@@ -1353,7 +1353,7 @@ func TestRemoveConnections(t *testing.T) {
13531353
13541354 for _ , tc := range tests {
13551355 t .Run (tc .name , func (t * testing.T ) {
1356- pool , err := NewBigtableChannelPool (ctx , tc .initialSize , btopt .RoundRobin , dialFunc , poolOpts ()... )
1356+ pool , err := NewBigtableChannelPool (ctx , tc .initialSize , btopt .RoundRobin , dialFunc , time . Now (), poolOpts ()... )
13571357 if err != nil {
13581358 t .Fatalf ("Failed to create pool: %v" , err )
13591359 }
@@ -1375,7 +1375,7 @@ func TestRemoveConnections(t *testing.T) {
13751375
13761376 t .Run ("VerifyOldestIsRemoved" , func (t * testing.T ) {
13771377 poolSize := 5
1378- pool , err := NewBigtableChannelPool (ctx , poolSize , btopt .RoundRobin , dialFunc , poolOpts ()... )
1378+ pool , err := NewBigtableChannelPool (ctx , poolSize , btopt .RoundRobin , dialFunc , time . Now (), poolOpts ()... )
13791379 if err != nil {
13801380 t .Fatalf ("Failed to create pool: %v" , err )
13811381 }
@@ -1449,7 +1449,7 @@ func TestConnPoolStatisticsVisitor(t *testing.T) {
14491449 addr := setupTestServer (t , fake )
14501450 dialFunc := func () (* BigtableConn , error ) { return dialBigtableserver (addr ) }
14511451
1452- pool , err := NewBigtableChannelPool (ctx , poolSize , btopt .RoundRobin , dialFunc , poolOpts ()... )
1452+ pool , err := NewBigtableChannelPool (ctx , poolSize , btopt .RoundRobin , dialFunc , time . Now (), poolOpts ()... )
14531453 if err != nil {
14541454 t .Fatalf ("Failed to create pool: %v" , err )
14551455 }
@@ -1537,7 +1537,7 @@ func setupBenchmarkPool(b *testing.B, strategy btopt.LoadBalancingStrategy, pool
15371537 }
15381538
15391539 ctx := context .Background ()
1540- pool , err := NewBigtableChannelPool (ctx , poolSize , strategy , dialFunc , poolOpts ()... )
1540+ pool , err := NewBigtableChannelPool (ctx , poolSize , strategy , dialFunc , time . Now (), poolOpts ()... )
15411541 if err != nil {
15421542 b .Fatalf ("Failed to create pool: %v" , err )
15431543 }
0 commit comments