migrate/database/spanner/spanner_test.go

29 lines
476 B
Go
Raw Normal View History

2017-06-14 17:46:10 +00:00
package spanner
import (
"fmt"
"os"
"testing"
dt "github.com/golang-migrate/migrate/database/testing"
2017-06-14 17:46:10 +00:00
)
func Test(t *testing.T) {
if testing.Short() {
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"))
}