@@ -365,7 +365,7 @@ func TestQueryContextWait(t *testing.T) {
365
365
defer closeDB (t , db )
366
366
prepares0 := numPrepares (t , db )
367
367
368
- ctx , cancel := context .WithTimeout (context .Background (), time .Millisecond * 15 )
368
+ ctx , cancel := context .WithTimeout (context .Background (), 15 * time .Millisecond )
369
369
defer cancel ()
370
370
371
371
// This will trigger the *fakeConn.Prepare method which will take time
@@ -387,7 +387,7 @@ func TestTxContextWait(t *testing.T) {
387
387
db := newTestDB (t , "people" )
388
388
defer closeDB (t , db )
389
389
390
- ctx , cancel := context .WithTimeout (context .Background (), time .Millisecond * 15 )
390
+ ctx , cancel := context .WithTimeout (context .Background (), 15 * time .Millisecond )
391
391
defer cancel ()
392
392
393
393
tx , err := db .BeginTx (ctx , nil )
@@ -566,13 +566,13 @@ func TestPoolExhaustOnCancel(t *testing.T) {
566
566
saturate .Wait ()
567
567
568
568
// Now cancel the request while it is waiting.
569
- ctx , cancel := context .WithTimeout (context .Background (), time .Second * 2 )
569
+ ctx , cancel := context .WithTimeout (context .Background (), 2 * time .Second )
570
570
defer cancel ()
571
571
572
572
for i := 0 ; i < max ; i ++ {
573
573
ctxReq , cancelReq := context .WithCancel (ctx )
574
574
go func () {
575
- time .Sleep (time . Millisecond * 100 )
575
+ time .Sleep (100 * time . Millisecond )
576
576
cancelReq ()
577
577
}()
578
578
err := db .PingContext (ctxReq )
@@ -1807,8 +1807,8 @@ func TestConnMaxLifetime(t *testing.T) {
1807
1807
}
1808
1808
1809
1809
// Expire first conn
1810
- offset = time . Second * 11
1811
- db .SetConnMaxLifetime (time . Second * 10 )
1810
+ offset = 11 * time . Second
1811
+ db .SetConnMaxLifetime (10 * time . Second )
1812
1812
if err != nil {
1813
1813
t .Fatal (err )
1814
1814
}
@@ -2765,7 +2765,7 @@ func TestIssue18719(t *testing.T) {
2765
2765
2766
2766
// Wait for the context to cancel and tx to rollback.
2767
2767
for tx .isDone () == false {
2768
- time .Sleep (time . Millisecond * 3 )
2768
+ time .Sleep (3 * time . Millisecond )
2769
2769
}
2770
2770
}
2771
2771
defer func () { hookTxGrabConn = nil }()
0 commit comments