Skip to content

Commit 97c9c04

Browse files
Merge pull request ngrok#22 from antoinedeschenes/fix-ctx-tests
fix linting issues in tests
2 parents 2e797f3 + 0c3f7c4 commit 97c9c04

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

conn_test.go

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ import (
77
"testing"
88
)
99

10+
type connCtxKey string
11+
1012
const (
11-
connRowContextKey = "context"
12-
connRowContextValue = "value"
13-
connStmtContextKey = "stmtcontext"
14-
connStmtContextValue = "stmtvalue"
15-
connTxContextKey = "txcontext"
16-
connTxContextValue = "txvalue"
13+
connRowContextKey connCtxKey = "context"
14+
connRowContextValue string = "value"
15+
connStmtContextKey connCtxKey = "stmtcontext"
16+
connStmtContextValue string = "stmtvalue"
17+
connTxContextKey connCtxKey = "txcontext"
18+
connTxContextValue string = "txvalue"
1719
)
1820

1921
type connTestInterceptor struct {
@@ -204,12 +206,14 @@ func TestConnBeginTx_PassWrappedTxContextCommit(t *testing.T) {
204206
t.Fatalf("Prepare failed: %s", err)
205207
}
206208

207-
tx.Commit()
209+
err = tx.Commit()
210+
if err != nil {
211+
t.Fatalf("Commit failed: %s", err)
212+
}
208213

209214
if !ti.TxCommitValid {
210215
t.Error("TxCommit context not valid")
211216
}
212-
213217
}
214218
func TestConnBeginTx_PassWrappedTxContextRollback(t *testing.T) {
215219
driverName := driverName(t)
@@ -241,7 +245,10 @@ func TestConnBeginTx_PassWrappedTxContextRollback(t *testing.T) {
241245
t.Fatalf("Prepare failed: %s", err)
242246
}
243247

244-
tx.Rollback()
248+
err = tx.Rollback()
249+
if err != nil {
250+
t.Fatalf("Rollback failed: %s", err)
251+
}
245252

246253
if !ti.TxRollbackValid {
247254
t.Error("TxRollback context not valid")

stmt_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ import (
77
"testing"
88
)
99

10+
type stmtCtxKey string
11+
1012
const (
11-
stmtRowContextKey = "rowcontext"
12-
stmtRowContextValue = "rowvalue"
13+
stmtRowContextKey stmtCtxKey = "rowcontext"
14+
stmtRowContextValue string = "rowvalue"
1315
)
1416

1517
type stmtTestInterceptor struct {

0 commit comments

Comments
 (0)