-
Notifications
You must be signed in to change notification settings - Fork 4k
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
chore(cli-testing): add a retry for test #29871
Conversation
One of our tests can remove customPermissionsBoundary creates a policy using createPolicy. Change to IAM policies/roles use eventual consistency. So, while the changes will show up right away if we were to call an API to describe that policy/role, the updates may not have actually propagated to all regions yet. This is likely the cause of the intermittant test failures for this test. This change adds the eventually block and uses it to retry initial creation of this stack in the case that the policy changes have not made it to the relevant region just yet.
Linter isn't asking us to send this to the pipeline? |
@Mergifyio update |
✅ Branch has been successfully updated |
* @param fn function to run | ||
* @param options EventuallyOptions | ||
*/ | ||
const eventually = async <T>(call: () => Promise<T>, options?: EventuallyOptions): Promise<T> => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if eventually
is a standard naming convention but I love it.
param => (param.ParameterKey === 'InputPermissionsBoundary' && param.ParameterValue === policyName), | ||
)).toEqual(true); | ||
// Policy creation and consistency across regions is "almost immediate" | ||
// See: https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_general.html#troubleshoot_general_eventual-consistency |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch on this and thank you for also adding it as a comment!
)).toEqual(true); | ||
}; | ||
|
||
await eventually(createStackWithPermissionBoundary, { maxAttempts: 3 }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not blocking on this, but just curious why 3?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Arbitrarily seemed reasonable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@Mergifyio update |
✅ Branch has been successfully updated |
@Mergifyio update |
✅ Branch has been successfully updated |
➡️ PR build request submitted to A maintainer must now check the pipeline and add the |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
One of our tests
can remove customPermissionsBoundary
creates a policy using createPolicy. Change to IAM policies/roles use eventual consistency. So, while the changes will show up right away if we were to call an API to describe that policy/role, the updates may not have actually propagated to all regions yet. This is likely the cause of the intermittent test failures for this test.This change adds the
eventually
block and uses it to retry initial creation of this stack in the case that the policy changes have not made it to the relevant region just yet.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license