Skip to content

Commit

Permalink
Use a longer timeout since the Docker host and network may be slower …
Browse files Browse the repository at this point in the history
…on TravisCI
  • Loading branch information
dhui committed Jan 4, 2019
1 parent ee6d5a0 commit 76d3fe2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
4 changes: 3 additions & 1 deletion savepointers/mssql/mssql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"database/sql"
"fmt"
"testing"
"time"
)

import (
Expand All @@ -17,6 +18,7 @@ import (

const (
password = "insecurePassword1"
timeout = 3 * time.Minute
)

var env = map[string]string{
Expand Down Expand Up @@ -48,7 +50,7 @@ func TestSavepointerMSSQL(t *testing.T) {
v := v
t.Run(v, func(t *testing.T) {
t.Parallel()
dktest.Run(t, v, dktest.Options{Env: env, PortRequired: true, ReadyFunc: readyFunc},
dktest.Run(t, v, dktest.Options{Env: env, PortRequired: true, ReadyFunc: readyFunc, Timeout: timeout},
func(t *testing.T, c dktest.ContainerInfo) {
connStr := fmt.Sprintf("sqlserver://sa:%s@%s:%s", password, c.IP, c.Port)
db, err := sql.Open("sqlserver", connStr)
Expand Down
4 changes: 3 additions & 1 deletion savepointers/mysql/mysql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"database/sql"
"fmt"
"testing"
"time"
)

import (
Expand All @@ -18,6 +19,7 @@ import (
const (
password = "insecurepassword"
db = "public"
timeout = 3 * time.Minute
)

var env = map[string]string{
Expand Down Expand Up @@ -50,7 +52,7 @@ func TestSavepointerMySQL(t *testing.T) {
v := v
t.Run(v, func(t *testing.T) {
t.Parallel()
dktest.Run(t, v, dktest.Options{Env: env, PortRequired: true, ReadyFunc: readyFunc},
dktest.Run(t, v, dktest.Options{Env: env, PortRequired: true, ReadyFunc: readyFunc, Timeout: timeout},
func(t *testing.T, c dktest.ContainerInfo) {
connStr := fmt.Sprintf("root:%s@tcp(%s:%s)/%s", password, c.IP, c.Port, db)
db, err := sql.Open("mysql", connStr)
Expand Down
7 changes: 6 additions & 1 deletion savepointers/postgres/postgres_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"database/sql"
"fmt"
"testing"
"time"
)

import (
Expand All @@ -15,6 +16,10 @@ import (
"github.com/dhui/satomic/savepointers/postgres"
)

const (
timeout = 3 * time.Minute
)

func readyFunc(c dktest.ContainerInfo) bool {
connStr := fmt.Sprintf("host=%s port=%s user=postgres dbname=postgres sslmode=disable", c.IP, c.Port)
db, err := sql.Open("postgres", connStr)
Expand All @@ -41,7 +46,7 @@ func TestSavepointerPostgres(t *testing.T) {
v := v
t.Run(v, func(t *testing.T) {
t.Parallel()
dktest.Run(t, v, dktest.Options{PortRequired: true, ReadyFunc: readyFunc},
dktest.Run(t, v, dktest.Options{PortRequired: true, ReadyFunc: readyFunc, Timeout: timeout},
func(t *testing.T, c dktest.ContainerInfo) {
connStr := fmt.Sprintf("host=%s port=%s user=postgres dbname=postgres sslmode=disable",
c.IP, c.Port)
Expand Down

0 comments on commit 76d3fe2

Please sign in to comment.