Skip to main content

Gcp

Testing integration with GCS in Go

·5 mins

As I wrote in my previous post, I have a strong preference towards automated acceptance testing on a service-level. So, when I recently faced a need of creating a Go API related to file management that uses GCS as a storage, I started looking for some way to test it this way. Unfortunately, Google doesn’t provide any simulator for GCS similar and there is also no the-one-to-rule-them-all tool such as Localstack, which I’ve been successfully using for years working with AWS services. I found fsouza/fake-gcs-server good enough and quite popular, so I started with that. Although, there are some samples in the project itself and a couple of blog posts how to start using it, I had to solve a couple of issues, which I think can be interesting, if you’re working with this tool in your Go application.