github.com/kruftik/go-migrate@v3.5.4+incompatible/database/spanner/spanner_test.go (about)

     1  package spanner
     2  
     3  import (
     4  	"fmt"
     5  	"os"
     6  	"testing"
     7  
     8  	dt "github.com/golang-migrate/migrate/database/testing"
     9  )
    10  
    11  func Test(t *testing.T) {
    12  	if testing.Short() {
    13  		t.Skip("skipping test in short mode.")
    14  	}
    15  
    16  	db, ok := os.LookupEnv("SPANNER_DATABASE")
    17  	if !ok {
    18  		t.Skip("SPANNER_DATABASE not set, skipping test.")
    19  	}
    20  
    21  	s := &Spanner{}
    22  	addr := fmt.Sprintf("spanner://%v", db)
    23  	d, err := s.Open(addr)
    24  	if err != nil {
    25  		t.Fatalf("%v", err)
    26  	}
    27  	dt.Test(t, d, []byte("SELECT 1"))
    28  }