google-cloud-go icon indicating copy to clipboard operation
google-cloud-go copied to clipboard

feat(bigtable/emulator): allow listening on Unix Domain Sockets

Open flokli opened this issue 1 year ago • 3 comments

cbtemulator listening on unix domain sockets is much easier than trying to allocate free TCP ports, especially if many cbtemulators are run at the same time in integration tests.

This adds an additional flag, address, which has priority if it's set, rather than host:port.

NewServer already takes a laddr string, so we simply check for it to contain slashes, and if so, listen on unix, rather than TCP.

flokli avatar Mar 29 '24 09:03 flokli

This can be tested as follows:

$ ./emulator --address $PWD/emulator.sock &
Cloud Bigtable emulator running on /home/flokli/dev/google-cloud-go/bigtable/cmd/emulator/emulator.sock
$ export BIGTABLE_EMULATOR_HOST=unix://$PWD/emulator.sock
$ cbt -instance instance-1 -project project-1 createtable table-1
2024/03/29 11:02:04 -creds flag unset, will use gcloud credential
$ cbt -instance instance-1 -project project-1 ls
2024/03/29 11:02:15 -creds flag unset, will use gcloud credential
table-1

No changes in the client sdk itself needed, only in the emulator.

flokli avatar Mar 29 '24 10:03 flokli

conventionalcommits.org seems stuck on an old commit message, not sure how to get it unstuck.

flokli avatar Mar 29 '24 10:03 flokli

I got confused over the conventionalcommits.org check - it was complaining about the PR title, not commit messages. It's green now, and the PR is rebased. Would be nice to get some feedback :-)

flokli avatar Apr 09 '24 19:04 flokli