googleapis / googleapis/google-cloud-go

spannertest: rollback of transactions in spannertest

Open
#2,824 1 comment 4 reactions 1 assignee Claimed by @dsymonds View on GitHub
api: spanner priority: p3 type: feature request
Dominant language
Go
Stars
4.5k
Forks
1.6k
Avg merge
1d 13h
Merged PRs (30d)
109

Description

**Is your feature request related to a problem? Please describe.**
We have a solution that uses three separate tables. Any update to the data should update rows in all, or none of the tables.

We have written code that return the corresponding mutations, and now we want to ensure that CRUD works as intended. On a first glance it seemed like there was transaction support in spannertest:
https://github.com/googleapis/google-cloud-go/blob/master/spanner/spannertest/inmem.go#L663-L725

However the rollback does not do anything yet:
https://github.com/googleapis/google-cloud-go/blob/92af398bdb5e7536f15945485980dc8736597227/spanner/spannertest/db.go#L143-L148

**Describe the solution you'd like**
We would love for spannertest to roll back transactions when there is an error. That way we can keep relying on spannertest for our unit tests in our CI/CD environment.

**Describe alternatives you've considered**
We have considered running the [Cloud Spanner Emulator](https://cloud.google.com/spanner/docs/emulator) in our tests, however that will not play nice with our CI/CD setup. It does work when testing locally, which gives us some confidence in our solution, however having the proper support in spannertest would be better.

**Additional context**
-

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.