Skip to content

Commit 29402f1

Browse files
fix test
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
1 parent 2361c38 commit 29402f1

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

go/vt/vttablet/endtoend/transaction_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -892,6 +892,9 @@ func TestSkipUserMetrics(t *testing.T) {
892892

893893
// Enable SkipUserMetrics and re-run tests
894894
framework.Server.Config().SkipUserMetrics = true
895+
defer func() {
896+
framework.Server.Config().SkipUserMetrics = false
897+
}()
895898
vstart = framework.DebugVars()
896899
runQueries()
897900

go/vt/vttablet/tabletserver/dt_executor_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,11 @@ import (
3131
"github.com/stretchr/testify/require"
3232
"google.golang.org/protobuf/proto"
3333

34-
"vitess.io/vitess/go/streamlog"
35-
3634
"vitess.io/vitess/go/event/syslogger"
3735
"vitess.io/vitess/go/mysql/fakesqldb"
3836
"vitess.io/vitess/go/mysql/sqlerror"
3937
"vitess.io/vitess/go/sqltypes"
38+
"vitess.io/vitess/go/streamlog"
4039
querypb "vitess.io/vitess/go/vt/proto/query"
4140
topodatapb "vitess.io/vitess/go/vt/proto/topodata"
4241
"vitess.io/vitess/go/vt/vtenv"
@@ -58,7 +57,7 @@ func TestTxExecutorEmptyPrepare(t *testing.T) {
5857
// taint the connection.
5958
sc, err := tsv.te.txPool.GetAndLock(txid, "taint")
6059
require.NoError(t, err)
61-
sc.Taint(ctx, nil)
60+
sc.Taint(ctx, tsv.te.reservedConnStats)
6261
sc.Unlock()
6362

6463
err = txe.Prepare(txid, "aa")
@@ -80,7 +79,7 @@ func TestExecutorPrepareFailure(t *testing.T) {
8079
// taint the connection.
8180
sc, err := tsv.te.txPool.GetAndLock(txid, "taint")
8281
require.NoError(t, err)
83-
sc.Taint(ctx, nil)
82+
sc.Taint(ctx, tsv.te.reservedConnStats)
8483
sc.Unlock()
8584

8685
// try 2pc commit of Metadata Manager.
@@ -374,7 +373,7 @@ func TestExecutorStartCommitFailure(t *testing.T) {
374373
// taint the connection.
375374
sc, err := tsv.te.txPool.GetAndLock(txid, "taint")
376375
require.NoError(t, err)
377-
sc.Taint(ctx, nil)
376+
sc.Taint(ctx, tsv.te.reservedConnStats)
378377
sc.Unlock()
379378

380379
// add rollback state update expectation

go/vt/vttablet/tabletserver/stateful_connection_pool_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
"vitess.io/vitess/go/sqltypes"
2828
"vitess.io/vitess/go/vt/dbconfigs"
2929
querypb "vitess.io/vitess/go/vt/proto/query"
30+
"vitess.io/vitess/go/vt/servenv"
3031
"vitess.io/vitess/go/vt/vttablet/tabletserver/tx"
3132
)
3233

@@ -96,24 +97,25 @@ func TestStatefulPoolShutdownNonTx(t *testing.T) {
9697
pool := newActivePool()
9798
params := dbconfigs.New(db.ConnParams())
9899
pool.Open(params, params, params)
100+
rcStats := servenv.NewExporter("TestStatefulPoolShutdownNonTx", "").NewTimings("rconn", "test1", "test2")
99101

100102
// conn1 non-tx, not in use.
101103
conn1, err := pool.NewConn(ctx, &querypb.ExecuteOptions{}, nil)
102104
require.NoError(t, err)
103-
conn1.Taint(ctx, nil)
105+
conn1.Taint(ctx, rcStats)
104106
conn1.Unlock()
105107

106108
// conn2 tx, not in use.
107109
conn2, err := pool.NewConn(ctx, &querypb.ExecuteOptions{}, nil)
108110
require.NoError(t, err)
109-
conn2.Taint(ctx, nil)
111+
conn2.Taint(ctx, rcStats)
110112
conn2.txProps = &tx.Properties{}
111113
conn2.Unlock()
112114

113115
// conn3 non-tx, in use.
114116
conn3, err := pool.NewConn(ctx, &querypb.ExecuteOptions{}, nil)
115117
require.NoError(t, err)
116-
conn3.Taint(ctx, nil)
118+
conn3.Taint(ctx, rcStats)
117119

118120
// After ShutdownNonTx, conn1 should be closed, but not conn3.
119121
pool.ShutdownNonTx()

0 commit comments

Comments
 (0)