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

Tests for PR 8991 #9021

Closed
wants to merge 11 commits into from
Closed

Tests for PR 8991 #9021

wants to merge 11 commits into from

Conversation

tyrannosaurus-becks
Copy link
Contributor

@tyrannosaurus-becks tyrannosaurus-becks commented May 18, 2020

This PR is only the tests used for verifying #8991. They've been separated out so that PR will only contain the minimum code change necessary for the fix.

One of the factors in AWS renewals being broken was that current tests did not flag issues with renewals. This PR adds the ability to mock the AWS clients used, allowing tests to be easily run in all environments. The approach taken was as close as possible to AWS' recommended approach. There is also precedent for mocking the clients, as seen in the Azure secrets plugin.

The tests added would have flagged the issue. When run on master, they fail with:

--- FAIL: TestEC2LoginRenewDefaultSettings (0.00s)
    use_cases_test.go:134: unable to fetch instance ID from metadata during renewal
=== RUN   TestIAMLoginRenewDefaultSettings
--- FAIL: TestIAMLoginRenewDefaultSettings (0.00s)
    use_cases_test.go:270: unable to retrieve canonical ARN from metadata during renewal

On this branch, they pass.

Additional Tests

  • SCP'd this binary onto an AWS EC2 instance (Ubuntu 18.04 LTS in us-east-1) and performed login and renewal as described here for EC2 auth
  • Also followed same instructions for logging in and renewing with the IAM method

@tyrannosaurus-becks tyrannosaurus-becks changed the base branch from fix-aws-auth-renewals to master May 18, 2020 18:11
@mladlow mladlow added this to the 1.5 milestone May 19, 2020
@kalafut kalafut assigned kalafut and jasonodonnell and unassigned kalafut Jun 8, 2020
Copy link
Contributor

@jasonodonnell jasonodonnell left a comment

Choose a reason for hiding this comment

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

LGTM!

@pbernal pbernal modified the milestones: 1.5, triaged Jul 16, 2020
@jasonodonnell jasonodonnell deleted the tests-for-8991 branch May 6, 2024 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants