Skip to content

Commit 26a10d4

Browse files
committed
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.
1 parent 9cda5c7 commit 26a10d4

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

tests/functional/eks/test_get_token.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,18 +140,23 @@ def test_output_table(self, mock_datetime):
140140
def test_url(self):
141141
cmd = 'eks get-token --cluster-name %s' % self.cluster_name
142142
response = self.run_get_token(cmd)
143-
self.assert_url_correct(response)
143+
self.assert_url_correct(
144+
response,
145+
expected_endpoint='sts.us-east-1.amazonaws.com',
146+
)
144147

145148
def test_url_with_region(self):
146149
cmd = 'eks get-token --cluster-name %s' % self.cluster_name
147150
cmd += ' --region us-west-2'
148151
response = self.run_get_token(cmd)
149-
# Even though us-west-2 was specified, we should still only be
150-
# signing for the global endpoint.
152+
# Previously, even though us-west-2 is specified, we still
153+
# signed for the global endpoint. Now, the STS client defaults
154+
# to using the regional endpoint, so the expected signing region
155+
# should be the same as the endpoint region.
151156
self.assert_url_correct(
152157
response,
153-
expected_endpoint='sts.amazonaws.com',
154-
expected_signing_region='us-east-1',
158+
expected_endpoint='sts.us-west-2.amazonaws.com',
159+
expected_signing_region='us-west-2',
155160
)
156161

157162
def test_url_with_arn(self):
@@ -173,7 +178,11 @@ def test_url_with_arn(self):
173178
assume_role_call[1],
174179
{'RoleArn': self.role_arn, 'RoleSessionName': 'EKSGetTokenAuth'},
175180
)
176-
self.assert_url_correct(response, has_session_token=True)
181+
self.assert_url_correct(
182+
response,
183+
expected_endpoint='sts.us-east-1.amazonaws.com',
184+
has_session_token=True,
185+
)
177186

178187
def test_token_has_no_padding(self):
179188
cmd = 'eks get-token --cluster-name %s' % self.cluster_name

0 commit comments

Comments
 (0)