Fix flakey test by disabling EC2 metadata lookup in test case#1005
Open
kevinawoo wants to merge 1 commit intotemporalio:mainfrom
Open
Fix flakey test by disabling EC2 metadata lookup in test case#1005kevinawoo wants to merge 1 commit intotemporalio:mainfrom
kevinawoo wants to merge 1 commit intotemporalio:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TestCreateWorkerDeploymentVersion_Errors.Root Cause
The test intentionally passes fake AWS Lambda and assume-role inputs. Server-side worker-deployment validation uses
go.temporal.io/auto-scaled-workers, which imports the AWS SDK and validates theaws-lambdacompute provider. That path builds default AWS config and calls STS/Lambda validation.Before STS can assume the fake role, the AWS SDK needs base credentials. In a local or CI environment with no AWS env creds/profile/container creds, the AWS SDK falls back to EC2 Instance Metadata Service. Outside EC2, that means waiting on IMDS/network retries even though the test only wants an expected validation failure.
Scope of the Fix
This is broader AWS SDK behavior:
AWS_EC2_METADATA_DISABLED=trueis useful for any test/process that invokes AWS SDK default credential resolution without real credentials and should not hit EC2 IMDS.In this CLI test suite, the enabled surface is narrow:
TestCreateWorkerDeploymentVersion_Errorsis the only enabled test that passes a complete fake AWS Lambda compute config to the server.TestCreateWorkerDeploymentVersion_LambdaComputeConfigwould also hit the AWS path, but it is skipped because it needs real AWS fixtures.So the fix is intentionally test-local rather than package-wide, to avoid changing behavior for future tests that might intentionally exercise AWS credential resolution.
Validation
go test -mod=readonly ./internal/temporalcli -run 'TestSharedServerSuite/TestCreateWorkerDeploymentVersion_Errors' -count=1 -v