Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions tests/functional/eks/test_get_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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
Expand Down
Loading