Skip to content

Commit

Permalink
moves ping context test to go18 tests and update travis
Browse files Browse the repository at this point in the history
  • Loading branch information
l3pp4rd committed Sep 6, 2017
1 parent 009458c commit 54210f8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
13 changes: 8 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
language: go
go:
- 1.3
- 1.3.x
- 1.4
- 1.5
- 1.6
- 1.7
- 1.8
- 1.5.x
- 1.6.x
- 1.7.x
- 1.8.x
- 1.9.x

services: mysql

Expand All @@ -14,4 +15,6 @@ install:

script:
- make db
- go vet
- test -z "$(go fmt ./...)" # fail if not formatted properly
- go test -race
12 changes: 12 additions & 0 deletions db_go18_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,15 @@ func TestShouldGetMultiRowSet(t *testing.T) {
t.Fatal("unexpected number of users")
}
}

func TestShouldBeAbleToPingWithContext(t *testing.T) {
db, err := sql.Open("txdb", "ping")
if err != nil {
t.Fatalf("failed to open a mysql connection, have you run 'make test'? err: %s", err)
}
defer db.Close()

if err := db.PingContext(context.Background()); err != nil {
t.Fatal(err)
}
}
13 changes: 0 additions & 13 deletions db_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package txdb

import (
"context"
"database/sql"
"fmt"
"runtime"
Expand Down Expand Up @@ -170,15 +169,3 @@ func TestShouldBeAbleToLockTables(t *testing.T) {
t.Fatalf("should be able to unlock table, but got err: %v", err)
}
}

func TestShouldBeAbleToPingWithContext(t *testing.T) {
db, err := sql.Open("txdb", "ping")
if err != nil {
t.Fatalf("failed to open a mysql connection, have you run 'make test'? err: %s", err)
}
defer db.Close()

if err := db.PingContext(context.Background()); err != nil {
t.Fatal(err)
}
}

0 comments on commit 54210f8

Please sign in to comment.