aws / aws-sdk-go-v2

AWS SDK for the Go programming language.
https://aws.github.io/aws-sdk-go-v2/docs/
Apache License 2.0
2.68k stars 651 forks source link

Don't fail credentials unit tests if credentials are found on a file #2761

Closed Madrigal closed 3 months ago

Madrigal commented 3 months ago

My tests were failing locally since I use a script that populates the ~/.aws/credentials file. The tests were pulling these credentials and were failing locally with the following error

2024/08/23 09:43:13 config: go test -tags example,codegen,integration,ec2env,perftest -run NONE ./... =>
--- FAIL: TestResolveCredentialsIMDSClient (0.00s)
    --- 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>

This change sets an empty credentials file source when running these tests