2017-06-14 17:46:10 +00:00
|
|
|
package spanner
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
"testing"
|
|
|
|
|
2018-01-19 18:56:55 +00:00
|
|
|
dt "github.com/golang-migrate/migrate/database/testing"
|
2017-06-14 17:46:10 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func Test(t *testing.T) {
|
|
|
|
if testing.Short() {
|
2017-06-20 16:53:41 +00:00
|
|
|
t.Skip("skipping test in short mode.")
|
|
|
|
}
|
|
|
|
|
|
|
|
db, ok := os.LookupEnv("SPANNER_DATABASE")
|
|
|
|
if !ok {
|
|
|
|
t.Skip("SPANNER_DATABASE not set, skipping test.")
|
2017-06-14 17:46:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
s := &Spanner{}
|
|
|
|
addr := fmt.Sprintf("spanner://%v", db)
|
|
|
|
d, err := s.Open(addr)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("%v", err)
|
|
|
|
}
|
|
|
|
dt.Test(t, d, []byte("SELECT 1"))
|
|
|
|
}
|