cognitect-labs / aws-api

AWS, data driven
Apache License 2.0
727 stars 100 forks source link

Failing test? #242

Open NoahTheDuke opened 1 year ago

NoahTheDuke commented 1 year ago

When I run the tests locally, I see a failure at the line below. The tests pass if I add :region "us-east-1" to the client map. I am not super familiar with the library, so my apologies if this is due to dev misconfiguration.

https://github.com/cognitect-labs/aws-api/blob/5900e359365041ed9380947d010b0f0a853e793c/test/src/cognitect/aws/api_test.clj#L17

scottbale commented 11 months ago

Hi @NoahTheDuke

Super-short answer: for me, the default region is picked up from my ~/.aws/config file, which has a line indicating the default region.

Slightly longer answer: if a :region is not explicitly passed to the aws client function, then as the docstring indicates the region will be gotten from the default region provider. Which is a chained provider, and the "profile region provider" (third in the chain) will look for a default region in your AWS configuration profile file (~/.aws/config by default).

NoahTheDuke commented 11 months ago

Thanks for the explanation. Should the tests pass that so they aren't reliant on external configuration?

scottbale commented 11 months ago

@NoahTheDuke I see your point, I'll reopen the issue. Yes ideally api-test unit test shouldn't pass or fail based on an external thing like the default region provider, which depends on the user's environment. And then maybe we're missing a test that fails if the default region provider fails to find a region - that would better alert the user to what the problem is.