Fix MySQL docker image connection testing

This commit is contained in:
Dale Hui 2018-01-19 14:50:31 -08:00
parent 31367fbc97
commit 7c9a261dc0
1 changed files with 5 additions and 5 deletions

View File

@ -2,7 +2,7 @@ package mysql
import (
"database/sql"
sqldriver "database/sql/driver"
// sqldriver "database/sql/driver"
"fmt"
// "io/ioutil"
// "log"
@ -21,14 +21,14 @@ var versions = []mt.Version{
}
func isReady(i mt.Instance) bool {
db, err := sql.Open("mysql", fmt.Sprintf("root:root@tcp(%v:%v)/public", i.Host(), i.Port()))
connStr := fmt.Sprintf("root:root@tcp(%v:%v)/public", i.Host(), i.Port())
fmt.Println(connStr)
db, err := sql.Open("mysql", connStr)
if err != nil {
return false
}
defer db.Close()
err = db.Ping()
if err == sqldriver.ErrBadConn {
if err = db.Ping(); err != nil {
return false
}