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

lib/integrations/awsoidc test fails locally #53687

Open
bl-nero opened this issue Apr 3, 2025 · 8 comments
Open

lib/integrations/awsoidc test fails locally #53687

bl-nero opened this issue Apr 3, 2025 · 8 comments
Labels

Comments

@bl-nero
Copy link
Contributor

bl-nero commented Apr 3, 2025

Ran using go test ./lib/integrations/awsoidc on Mac OS (Arm). Also visible when running via make test-go-unit. Error:

--- FAIL: TestNewIdPIAMConfigureClient (0.00s)
    --- FAIL: TestNewIdPIAMConfigureClient/no_aws_region_env_var,_returns_an_error (0.00s)
        idp_iam_config_test.go:562:
            	Error Trace:	/Users/bartosz/code/teleport/lib/integrations/awsoidc/idp_iam_config_test.go:562
            	Error:      	An error is expected but got nil.
            	Test:       	TestNewIdPIAMConfigureClient/no_aws_region_env_var,_returns_an_error
@marcoandredinis
Copy link
Contributor

Can you please confirm whether the #53698 fixes this?
The only way I could reproduce the failure was by explicitly setting the AWS_REGION env var before running the test.

@bl-nero
Copy link
Contributor Author

bl-nero commented Apr 4, 2025

@marcoandredinis I also suspected that the region var plays a role here, but I don't have it set at all - and your proposed fix doesn't work in my case.

@bl-nero
Copy link
Contributor Author

bl-nero commented Apr 4, 2025

I'm attaching a test log, if that helps. test-log.txt

@bl-nero
Copy link
Contributor Author

bl-nero commented Apr 4, 2025

Also: running the test with AWS_REGION set doesn't change anything.

@zmb3
Copy link
Collaborator

zmb3 commented Apr 4, 2025

No issues for me:

 ➜ go test ./lib/integrations/awsoidc -run TestNewIdPIAMConfigureClient -count=100
ok      github.com/gravitational/teleport/lib/integrations/awsoidc      1.050s

@marcoandredinis
Copy link
Contributor

I was able to reproduce a failure by setting the env var

marcodinis@MarcoM3 ~/s/teleport (master)> go test -run TestNewIdPIAMConfigureClient github.com/gravitational/teleport/lib/integrations/awsoidc -count 1
ok      github.com/gravitational/teleport/lib/integrations/awsoidc      1.018s
marcodinis@MarcoM3 ~/s/teleport (master)> AWS_REGION=abcd go test -run TestNewIdPIAMConfigureClient github.com/gravitational/teleport/lib/integrations/awsoidc -coun
t 1
--- FAIL: TestNewIdPIAMConfigureClient (0.00s)
    --- FAIL: TestNewIdPIAMConfigureClient/no_aws_region_env_var,_returns_an_error (0.00s)
        idp_iam_config_test.go:562: 
                Error Trace:    /Users/marcodinis/src/teleport/lib/integrations/awsoidc/idp_iam_config_test.go:562
                Error:          An error is expected but got nil.
                Test:           TestNewIdPIAMConfigureClient/no_aws_region_env_var,_returns_an_error
FAIL
FAIL    github.com/gravitational/teleport/lib/integrations/awsoidc      1.025s
FAIL

Hence, my fix. But it might be something else.

Can you please check your env | grep AWS_ and your ~/.aws/config ? They might be setting a region (eg there's AWS_REGION and AWS_DEFAULT_REGION).

@bl-nero
Copy link
Contributor Author

bl-nero commented Apr 7, 2025

@marcoandredinis Indeed, I investigated the environment variable, but forgot about the config file itself. Removing the default profile helped. The question remains whether this should or should not influence this unit test, so up to you whether to close this issue or fix it. Thanks!

@marcoandredinis
Copy link
Contributor

marcoandredinis commented Apr 8, 2025

I'll try to merge #53698 because I still see value in that PR even if it doesn't fix the root cause of your use case.

I'm fine leaving this as is for now.
I have mixed feelings about checking the contents of ~/.aws/config or whatever file $AWS_CONFIG_FILE points to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants