Skip to content

updated test to dynamically fetch credential - #140

Merged
vijaypdwivedi merged 3 commits into
masterfrom
feature-OBS04O-77-ts-dynamic-credential
Sep 15, 2026
Merged

vijaypdwivedi merged 3 commits into
masterfrom
feature-OBS04O-77-ts-dynamic-credential

Conversation

@vijaypdwivedi

@vijaypdwivedi vijaypdwivedi commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

OBS04O-77 | Enhance S3TempCredentialsTest to dynamically fetch temporary credentials via STS
##Summary
• Enhanced S3TempCredentialsTest to dynamically fetch temporary credentials at runtime using STS AssumeRole , eliminating the need for static, pre-
generated credentials that expire and require manual rotation
• Follows the same pattern used by ECS Sync's EcsS3Test for temporary credential handling on Dell ECS/OBS clusters
• Added aws-java-sdk-sts and aws-java-sdk-iam as testImplementation dependencies (no impact on production artifact or published POM)
• Added sts.endpoint and iam.endpoint properties to TestProperties.java and test.properties.template

##What changed

S3TempCredentialsTest.java
• @BeforeClass creates IAM user, IAM role (with AssumeRole trust policy), and STS client — runs once per test class
• createS3Config() calls stsClient.assumeRole() per test to get fresh temporary credentials
• Falls back to static credentials from properties if sts.endpoint / iam.endpoint not configured (backward compatible)
• createBucket() overridden to use owner credentials and set bucket policy granting the assumed role access
• cleanUpBucket() overridden to use owner credentials
@afterclass cleans up IAM user (and access keys) and role
• Added @ignore for inherited tests that require account-level permissions not available with temporary credentials (e.g., listBuckets , createBucket, deleteBucket , setBucketPolicy )

build.gradle

• Added com.amazonaws:aws-java-sdk-sts:1.12.766 and com.amazonaws:aws-java-sdk-iam:1.12.766 as testImplementation — test-only, zero impact on production classpath or published POM
• Uses AWS SDK v1 (not v2) because Dell ECS IAM/STS endpoints return XML incompatible with SDK v2 parsers

TestProperties.java

• Added STS_ENDPOINT and IAM_ENDPOINT constants

test.properties.template

• Documented sts.endpoint and iam.endpoint properties
• Marked static temp credential properties as legacy fallback

With s3.iam_user=true | 116 test cases are now passing out of 141. Previously, all 141 test cases were failing.
Screenshot 2026-09-15 172036

Comment thread src/test/resources/test.properties.template Outdated
Comment thread build.gradle
@xiaoxin-ren
xiaoxin-ren self-requested a review September 15, 2026 09:13
@vijaypdwivedi
vijaypdwivedi merged commit 25549cd into master Sep 15, 2026
@vijaypdwivedi
vijaypdwivedi deleted the feature-OBS04O-77-ts-dynamic-credential branch September 15, 2026 12:23
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.

2 participants