Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow running tests when AWS_PROFILE is set, needed for STS users #6383

Merged
merged 1 commit into from
Apr 29, 2016

Conversation

bigkraig
Copy link
Contributor

I don't have a great understanding of how the testing system is set up, I just now learned how to run the acceptance tests with testacc and TEST=./builtin/providers/aws :)

A full test without TESTARGS will start to throw errors of no valid credentials, but with this patch you can at least test individual resources.

…ing testing when AWS_PROFILE is set without AWS_SECRET_ACCESS_KEY and AWS_ACCESS_KEY_ID.
}
if v := os.Getenv("AWS_SECRET_ACCESS_KEY"); v == "" {
t.Fatal("AWS_SECRET_ACCESS_KEY must be set for acceptance tests")
if v := os.Getenv("AWS_PROFILE"); v == "" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the normal precedence of profile vs keys set explicitly? If so, this LGTM - if not we should probably reverse it to work the same way as the AWS CLI?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested this and it goes with the keys first. I'll make some adjustments

@jen20
Copy link
Contributor

jen20 commented Apr 27, 2016

Hi @bigkraig! I've left a question inline in the code, but this looks good to me at least in principle!

@radeksimko
Copy link
Member

Related: #5019

@bigkraig
Copy link
Contributor Author

@jen20 I started to work on this and realized it may not be necessary. The client is still going to use the same variables it was using before.

Case 1:
You have all three variables set, no error and client works as normal

Case 2:
Nothing is set, you get unset AWS_ACCESS_KEY_ID error.

Case 3:
You have AWS_PROFILE set only, profile is used

Case 4:
You have AWS_PROFILE unset, normal keys are used

Case 5:
You have AWS_PROFILE set, and only one of the other two variables set, you still get the same unset error

@jen20
Copy link
Contributor

jen20 commented Apr 29, 2016

Thanks for the clarification @bigkraig! About to merge this - personally I'll find it helpful, and it looks like @radeksimko may also! Thanks for your work!

@ghost
Copy link

ghost commented Apr 26, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants