Open kcolford opened 4 months ago
this is what https://github.com/uber/kraken/pull/348 was supposed to be but that ended up just being an empty PR due a bot automatically updating my fork of this repo
@kcolford Can you please address the comments to take this PR forward.
Thank you.
@gkeesh7 I'm not sure how you expect these functions to be tested... all this change does is add a little bit of extra code to fetch the secret from a file instead of inline, it feels like one of those situations that's too obvious to test
Hi @kcolford, I'd suggest writing a unit test where you create a credentialStore
with appropriate values. Then you run the function and assert that its return values are as expected.
To test the specific case where the registry file is read/missing/etc., you can use the os
package's CreateTemp
function to create a temporary file, which you can then fill with whatever values the test requires. The test would delete the file at the end.
This lets you mount the registry password in a secret that is kept separate from regular configuration. Also it means that the password can be updated dynamically without restarting the process.