1

I am looking for a locally executable test double (mock/stub/fake etc.) that can be used for replacing the Google Cloud Secrets Manager used by my application. Something like Localstack in case of AWS. This would allow me to start my app locally and on CI without using any cloud resources.

I have tried searching for it but only found old threads saying that there is none. I am afraid it might be accurate still, but wanted to give it a try here as well, maybe someone knows of a small stub that did not make the headlines yet.

Esta Nagy
  • 219
  • 2
  • 9
  • I don't think there's a library but you can mock any external 3rd-party library. If you do some type inspection, you could create a decent mock. Looks like this person did some of that work successfully already --- https://stackoverflow.com/a/62393234/904956 – Wesley LeMahieu Feb 20 '23 at 19:48
  • Thanks @WesleyLeMahieu! I think one of the reasons it is hard to search for this is the name. Both AWS and GCP are called Secrets Manager which is generating a lot of confusion. For example the link you have shared appears to be AWS. – Esta Nagy Feb 20 '23 at 20:34
  • 1
    The `jest.mock()` bit is relevant since it's demonstrating how to mock a 3rd-party library. You could do something like `jest.mock('@google-cloud/secret-manager', () => ({}))` and start replicating the methods and classes you need to mock. – Wesley LeMahieu Feb 20 '23 at 20:38
  • 1
    This is geared towards GCP --- https://stackoverflow.com/a/64869636/904956 – Wesley LeMahieu Feb 20 '23 at 20:40
  • Thank you, this can be a valid fallback option! – Esta Nagy Feb 20 '23 at 20:42

0 Answers0