Skip to content
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

Unit tests not isolated from local aws config file #1993

Closed
aajtodd opened this issue Jan 23, 2023 · 2 comments · Fixed by #2160
Closed

Unit tests not isolated from local aws config file #1993

aajtodd opened this issue Jan 23, 2023 · 2 comments · Fixed by #2160
Labels
bug This issue is a bug. p2 This is a standard priority issue

Comments

@aajtodd
Copy link
Contributor

aajtodd commented Jan 23, 2023

Describe the bug

Running make unit on clean project checkout fails unit tests when ~/.aws/credentials has stale credentials

Expected Behavior

Tests should run without failure

Current Behavior

Failure from make unit

2023/01/23 16:10:22 config: go test -tags example,codegen,integration,ec2env,perftest -run NONE ./... =>                                                                           
--- FAIL: TestResolveCredentialsIMDSClient (0.01s)                                                                                                                                 
    --- FAIL: TestResolveCredentialsIMDSClient/env_var_DISABLED_true (0.00s)                                                                                                       
        resolve_credentials_test.go:505: unexpected error: <nil>                                                                                                                   
    --- FAIL: TestResolveCredentialsIMDSClient/env_var_DISABLED_false (0.00s)                                                                                                      
        resolve_credentials_test.go:495: expect error got none                                                                                                                     
    --- FAIL: TestResolveCredentialsIMDSClient/option_state_enabled_overrides_env_var_DISABLED_true (0.00s)                                                                        
        resolve_credentials_test.go:495: expect error got none                                                                                                                     
    --- FAIL: TestResolveCredentialsIMDSClient/option_state_disabled_overrides_env_var_DISABLED_false (0.00s)                                                                      
        resolve_credentials_test.go:505: unexpected error: <nil>                                                                                                                   
    --- FAIL: TestResolveCredentialsIMDSClient/default_no_options (0.00s)                                                                                                          
        resolve_credentials_test.go:495: expect error got none                                                                                                                     
    --- FAIL: TestResolveCredentialsIMDSClient/state_enabled (0.00s)                                                                                                               
        resolve_credentials_test.go:495: expect error got none                                                                                                                     
    --- FAIL: TestResolveCredentialsIMDSClient/state_disabled (0.00s)                                                                                                              
        resolve_credentials_test.go:505: unexpected error: <nil>                                                                                                                   
2023/01/23 16:10:31 http: TLS handshake error from 127.0.0.1:60862: remote error: tls: bad certificate                                                                             
FAIL                                                                                                                                                                               
FAIL    github.com/aws/aws-sdk-go-v2/config     11.296s                                                                                                                            
FAIL                                                                                                                                                                               
2023/01/23 16:10:36 config: go test -timeout=1m  ./... => error: failed to run command, exit status 1                                                                              
2023/01/23 16:10:36 a command failed                                                                                                                                               
exit status 1                                                                                                                                                                      
make: *** [unit-modules-.] Error 1             

Reproduction Steps

Create the [default] profile in ~/.aws/credentials with stale/expired session credentials

Possible Solution

Update unit tests to be isolated from local environment

Additional Information/Context

No response

AWS Go SDK V2 Module Versions Used

github.com/aws/aws-sdk-go-v2/config @ f95afa9

Compiler and Version used

1.17.6

Operating System and version

macOS 12.6.2

@aajtodd aajtodd added the bug This issue is a bug. label Jan 23, 2023
@isaiahvita
Copy link
Contributor

this also happens with rogue aws environment variables. for example, if i have this set

AWS_EC2_METADATA_DISABLED=true

then i get the same error

@RanVaknin RanVaknin added the p2 This is a standard priority issue label Mar 22, 2023
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. p2 This is a standard priority issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants