From 26a10d48cda3f3170545053c0c7acc827b9c4b5c Mon Sep 17 00:00:00 2001 From: Kenneth Daily Date: Wed, 30 Jul 2025 11:28:09 -0700 Subject: [PATCH] Update sts endpoint assertions The default behavior for which STS endpoint to use is changing from global to regional. These tests assume that the global endpoint will always be used, which is not the case for the default behavior from the botocore client. This change updates the tests to reflect that the regional endpoint will be used. --- tests/functional/eks/test_get_token.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/tests/functional/eks/test_get_token.py b/tests/functional/eks/test_get_token.py index f22211fa0013..4732fc5b081a 100644 --- a/tests/functional/eks/test_get_token.py +++ b/tests/functional/eks/test_get_token.py @@ -140,18 +140,23 @@ def test_output_table(self, mock_datetime): def test_url(self): cmd = 'eks get-token --cluster-name %s' % self.cluster_name response = self.run_get_token(cmd) - self.assert_url_correct(response) + self.assert_url_correct( + response, + expected_endpoint='sts.us-east-1.amazonaws.com', + ) def test_url_with_region(self): cmd = 'eks get-token --cluster-name %s' % self.cluster_name cmd += ' --region us-west-2' response = self.run_get_token(cmd) - # Even though us-west-2 was specified, we should still only be - # signing for the global endpoint. + # Previously, even though us-west-2 is specified, we still + # signed for the global endpoint. Now, the STS client defaults + # to using the regional endpoint, so the expected signing region + # should be the same as the endpoint region. self.assert_url_correct( response, - expected_endpoint='sts.amazonaws.com', - expected_signing_region='us-east-1', + expected_endpoint='sts.us-west-2.amazonaws.com', + expected_signing_region='us-west-2', ) def test_url_with_arn(self): @@ -173,7 +178,11 @@ def test_url_with_arn(self): assume_role_call[1], {'RoleArn': self.role_arn, 'RoleSessionName': 'EKSGetTokenAuth'}, ) - self.assert_url_correct(response, has_session_token=True) + self.assert_url_correct( + response, + expected_endpoint='sts.us-east-1.amazonaws.com', + has_session_token=True, + ) def test_token_has_no_padding(self): cmd = 'eks get-token --cluster-name %s' % self.cluster_name