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. :)
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.NewServerstarts listening on a real socket, it cannot be used in tests running withsynctest. 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.Listenerwould help. Then we could provide abufconn.Listeneror 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.Serverrelies on unexported fields to have a valid instance, and the constructor starts listening on a socket which isn't compatible withsynctest.Additional context
I really love
bttestas a package. We use Bigtable extensively, and it gives a ton of confidence for how things will work in production.synctestonly 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. :)