Skip to content

Commit

Permalink
Merge pull request ngrok#22 from antoinedeschenes/fix-ctx-tests
Browse files Browse the repository at this point in the history
fix linting issues in tests
  • Loading branch information
inconshreveable authored May 20, 2022
2 parents 2e797f3 + 0c3f7c4 commit 97c9c04
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
25 changes: 16 additions & 9 deletions conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ import (
"testing"
)

type connCtxKey string

const (
connRowContextKey = "context"
connRowContextValue = "value"
connStmtContextKey = "stmtcontext"
connStmtContextValue = "stmtvalue"
connTxContextKey = "txcontext"
connTxContextValue = "txvalue"
connRowContextKey connCtxKey = "context"
connRowContextValue string = "value"
connStmtContextKey connCtxKey = "stmtcontext"
connStmtContextValue string = "stmtvalue"
connTxContextKey connCtxKey = "txcontext"
connTxContextValue string = "txvalue"
)

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

tx.Commit()
err = tx.Commit()
if err != nil {
t.Fatalf("Commit failed: %s", err)
}

if !ti.TxCommitValid {
t.Error("TxCommit context not valid")
}

}
func TestConnBeginTx_PassWrappedTxContextRollback(t *testing.T) {
driverName := driverName(t)
Expand Down Expand Up @@ -241,7 +245,10 @@ func TestConnBeginTx_PassWrappedTxContextRollback(t *testing.T) {
t.Fatalf("Prepare failed: %s", err)
}

tx.Rollback()
err = tx.Rollback()
if err != nil {
t.Fatalf("Rollback failed: %s", err)
}

if !ti.TxRollbackValid {
t.Error("TxRollback context not valid")
Expand Down
6 changes: 4 additions & 2 deletions stmt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ import (
"testing"
)

type stmtCtxKey string

const (
stmtRowContextKey = "rowcontext"
stmtRowContextValue = "rowvalue"
stmtRowContextKey stmtCtxKey = "rowcontext"
stmtRowContextValue string = "rowvalue"
)

type stmtTestInterceptor struct {
Expand Down

0 comments on commit 97c9c04

Please sign in to comment.