Skip to content

lestrrat-go/spanner-emulator-driver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spanner-emulator-driver

Simple utility to run google's Spanner database emulator, aimed for testing purposes.

SYNOPSIS

import (
	"context"
	"testing"

	driver "github.com/lestrrat-go/spanner-emulator-driver"
	"github.com/stretchr/testify/require"
)

func TestDriver(t *testing.T) {
	dsn := driver.Config{
		Project:  `driver-test-project`,
		Instance: `driver-test-instance`,
		Database: `driver-test`,
	}

	d, err := driver.New(dsn.FormatDSN())
	require.NoError(t, err, `driver.New should succeed`)

	ctx, cancel := context.WithCancel(context.Background())
	defer cancel()

	exited := d.Run(ctx)

	require.NoError(t, d.Ready(ctx), `driver should start successfully`)

	// Your tests go here

	// Make sure to wait for the emulator to exit
	<-exited
}

About

Start/Stop Spanner Emulator from Go code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages