Skip to content

test(sts): refactor AssumeRole integration test to role-based credentials - #7396

Merged
joviegas merged 4 commits into
masterfrom
joviegas/iam-test-integ-update
Sep 24, 2026
Merged

joviegas merged 4 commits into
masterfrom
joviegas/iam-test-integ-update

Conversation

@joviegas

@joviegas joviegas commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Motivation and Context

The STS AssumeRole integration test created an IAM user and a long-term access
key on every run. This replaces that with an IAM role assumed by the identity the
test already runs as, so no static access key is created.

Modifications

  • Removed IAM user, managed policy, and access key creation from the integration
    test. It now sources the assume-role chain from the test's own credentials and
    creates only a temporary role that trusts the running identity.
  • Kept all three integration test cases with unchanged profiles, provider wiring,
    and assertions. The source credentials now carry a session token.
  • Moved the one no-session-token resolution case (previously only covered by the
    integration test) to a unit test in AssumeRoleProfileTest.

Testing

  • Junit and Integ tests

Screenshots (if appropriate)

License

  • I confirm that this pull request can be released under the Apache 2 license

@joviegas
joviegas requested a review from a team as a code owner September 22, 2026 23:40
@joviegas joviegas changed the title Joviegas/iam test integ update test(sts): refactor AssumeRole integration test to role-based credentials Sep 22, 2026
@joviegas
joviegas requested a review from alextwoods September 22, 2026 23:43
Comment on lines 237 to +239
System.clearProperty("aws.accessKeyId");
System.clearProperty("aws.secretAccessKey");
System.clearProperty("aws.sessionToken");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: I know some of this is pre-existing, but I think in theory we shouldn't trash these properties (ie, we should restore them to what they were before the test). Not sure, but EnvironmentVariableHelper might help?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

EnvironmentVariableHelper only handles environment variables, so it can't help with system properties. I'm also not sure restoring the previous value helps in practice: any test that depends on these properties sets them explicitly in its own scope rather than relying on values left behind by another test.

@joviegas
joviegas enabled auto-merge September 23, 2026 22:14
@joviegas
joviegas added this pull request to the merge queue Sep 23, 2026
Merged via the queue into master with commit ab9c943 Sep 24, 2026
13 of 14 checks passed
@github-actions

Copy link
Copy Markdown

This pull request has been closed and the conversation has been locked. Comments on closed PRs are hard for our team to see. If you need more assistance, please open a new issue that references this one.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Sep 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants