spanner-golang-test

command module
v0.0.0-...-5dcb184 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 9, 2020 License: MIT Imports: 2 Imported by: 0

README

spanner-golang-test

A golang unit test example for google spanner, using google spanner emulator provided by cloud-spanner-emulator.

Hopefully, it helps you. I create this since I can not find the straight-forward example for golang.

Setup

You need spanner emulator running:

docker run -d -p 9010:9010 -p 9020:9020 gcr.io/cloud-spanner-emulator/emulator:1.0.0

Test

Run make test. The test uses golang test suite, which will do:

  1. Create spanner instance on google spanner emulator
  2. Create spanner db on google spanner emulator
  3. Execute singer-table-ddl
  4. Truncate singer table before test
  5. Execute test(s)
  6. Drop database and instance on google spanner emulator

Database creation/drop is done as suggested by in cloud-spanner-emulator README.

Parts of code that might help you:

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL