Skip to content

bttest: Use in-memory buffers instead of binding on a real socket, or provide option to do so. #12348

@coxley

Description

@coxley

Is your feature request related to a problem? Please describe.

Ref: https://github.com/googleapis/google-cloud-go/blob/bigtable/v1.37.0/bigtable/bttest/inmem.go#L111

Because bttest.NewServer starts listening on a real socket, it cannot be used in tests running with synctest. We have tests that spin up in-memory replacements for dependencies, Bigtable being one of them. It causes us to fall back to tricky workarounds for synchronization in tests.

Describe the solution you'd like

Giving an option for callers to pass a custom net.Listener would help. Then we could provide a bufconn.Listener or something.

Whether it's a new function or not doesn't matter to me. Probably would have to be without breaking the existing signature.

Describe alternatives you've considered

There's not really a work around since the bttest.Server relies on unexported fields to have a valid instance, and the constructor starts listening on a socket which isn't compatible with synctest.

Additional context

I really love bttest as a package. We use Bigtable extensively, and it gives a ton of confidence for how things will work in production. synctest only recently got accepted as a proposal after the experiment, so I understand why it's not optimized for that.

That being said, it'd make things a lot easier if it were. :)

Metadata

Metadata

Assignees

Labels

api: bigtableIssues related to the Bigtable API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions