cycloidio / raws

[UNMAINTAINED] AWS Reader
MIT License
15 stars 0 forks source link

Make the example and Example function #4

Closed ifraixedes closed 6 years ago

ifraixedes commented 7 years ago

I think that it would be better to become the example an Example function

xlr-8 commented 7 years ago

Wouldn't this create some complication with the testing?

My understanding is that this code being run during test, I'm not sure on how that works with mocked calls. Have already faced such case?

ifraixedes commented 7 years ago

As far as I can understand, this main isn't runnable because it doesn't have required values https://github.com/cycloidio/raws/blob/master/example/main.go#L83L85

I would change it to take those values from env vars and in the main (Example function when it be converted) skip the execution if those values are empty. The Example functions don't require to have strong assertions so it isn't needed to check anything that's returned by AWS.

If you want, you can always print a message, if the required values are invalid or they produce an error on the calls, to indicate to check the values of such env vars.

The good thing of having an Example function is that on each test they are executed or at least compiled, ensuring that they don't get out of date when some changes are introduced.