@@ -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