Skip to content

Fix integ tests to make sure IAM role is cleaned up after test run#2275

Merged
normj merged 4 commits intodevfrom
normj/cleanup-testrole
Feb 5, 2026
Merged

Fix integ tests to make sure IAM role is cleaned up after test run#2275
normj merged 4 commits intodevfrom
normj/cleanup-testrole

Conversation

@normj
Copy link
Member

@normj normj commented Feb 4, 2026

Description of changes:
Noticed our CI account was failing tests because we had too many orphan IAM roles being left around from previous test runs. I tracked down where the role was being created and updated the delete code which was was failing because we need to be sure to remove attach policies first.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@normj normj added the Release Not Needed Add this label if a PR does not need to be released. label Feb 4, 2026
@normj normj requested a review from Copilot February 4, 2026 23:57
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes IAM role cleanup in integration tests by detaching managed policies before deleting the role. The issue was that orphaned IAM roles were accumulating in the CI account because role deletion was failing when policies were still attached.

Changes:

  • Added code to list and detach all managed policies from the IAM role before attempting deletion

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

normj and others added 3 commits February 4, 2026 16:17
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Removed unnecessary exception handling for role deletion.
Removed comment about detaching managed policies.
@normj normj merged commit ec0aca7 into dev Feb 5, 2026
9 of 10 checks passed
@normj normj deleted the normj/cleanup-testrole branch February 5, 2026 03:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Release Not Needed Add this label if a PR does not need to be released.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants