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

plugins/rest: refactor AWS credentials provider config validation #4081

Conversation

srenatus
Copy link
Contributor

@srenatus srenatus commented Dec 2, 2021

Some cleanup in the code and tests, follow-up to #2786 .

The tests can now run in isolation because one test case shouldn't depend on the env vars another test case has set.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
The TestNew case of rest_test.go had failed when run in isolation,
but passed when running all of the packages tests. With these
changes to how env vars are handled, it passed both alone and when
run with all the other tests.

Also migrated the TestWebIdentityCredentialService test to use
test.WithTempFS instead of dealing with the files itself.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
@srenatus srenatus force-pushed the sr/plugins/rest/refactor-config-validation branch from 7fd6e9c to 94b8c59 Compare December 2, 2021 10:40
@srenatus srenatus marked this pull request as ready for review December 2, 2021 10:48
Comment on lines +552 to +556
cfgs := map[bool]int{}
cfgs[ap.AWSEnvironmentCredentials != nil]++
cfgs[ap.AWSMetadataCredentials != nil]++
cfgs[ap.AWSWebIdentityCredentials != nil]++
cfgs[ap.AWSProfileCredentials != nil]++
Copy link
Member

Choose a reason for hiding this comment

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

Very clever.

@srenatus srenatus merged commit e8d1b5f into open-policy-agent:main Dec 7, 2021
@srenatus srenatus deleted the sr/plugins/rest/refactor-config-validation branch December 7, 2021 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants