@@ -600,7 +600,7 @@ void managedIdentityTest_IMDSRetry() throws Exception {
600
600
.build ();
601
601
602
602
// IMDS has different retry logic for certain status codes, such as 410
603
- when (httpClientMock .send (expectedRequest (IMDS , ManagedIdentityTestConstants .RESOURCE ))).thenReturn (expectedResponse (410 , ManagedIdentityTestConstants .MSI_ERROR_RESPONSE_500 ));
603
+ when (httpClientMock .send (expectedRequest (IMDS , ManagedIdentityTestConstants .RESOURCE ))).thenReturn (expectedResponse (HttpStatus . GONE . getCode () , ManagedIdentityTestConstants .MSI_ERROR_RESPONSE_500 ));
604
604
605
605
try {
606
606
acquireTokenCommon (ManagedIdentityTestConstants .RESOURCE ).get ();
@@ -612,7 +612,7 @@ void managedIdentityTest_IMDSRetry() throws Exception {
612
612
}
613
613
614
614
clearInvocations (httpClientMock );
615
- when (httpClientMock .send (expectedRequest (IMDS , ManagedIdentityTestConstants .RESOURCE ))).thenReturn (expectedResponse (500 , ManagedIdentityTestConstants .MSI_ERROR_RESPONSE_500 ));
615
+ when (httpClientMock .send (expectedRequest (IMDS , ManagedIdentityTestConstants .RESOURCE ))).thenReturn (expectedResponse (HttpStatus . INTERNAL_SERVER_ERROR . getCode () , ManagedIdentityTestConstants .MSI_ERROR_RESPONSE_500 ));
616
616
617
617
try {
618
618
acquireTokenCommon (ManagedIdentityTestConstants .RESOURCE ).get ();
@@ -642,8 +642,8 @@ void managedIdentityTest_RetrySucceedsAfterFailure() throws Exception {
642
642
643
643
// First call returns 500, subsequent calls return 200
644
644
when (httpClientMock .send (expectedRequest (IMDS , ManagedIdentityTestConstants .RESOURCE )))
645
- .thenReturn (expectedResponse (500 , ManagedIdentityTestConstants .MSI_ERROR_RESPONSE_500 ))
646
- .thenReturn (expectedResponse (200 , getSuccessfulResponse (ManagedIdentityTestConstants .RESOURCE )));
645
+ .thenReturn (expectedResponse (HttpStatus . INTERNAL_SERVER_ERROR . getCode () , ManagedIdentityTestConstants .MSI_ERROR_RESPONSE_500 ))
646
+ .thenReturn (expectedResponse (HttpStatus . OK . getCode () , getSuccessfulResponse (ManagedIdentityTestConstants .RESOURCE )));
647
647
648
648
IAuthenticationResult result = acquireTokenCommon (ManagedIdentityTestConstants .RESOURCE ).get ();
649
649
@@ -697,8 +697,8 @@ void managedIdentityTest_RetriesARePerRequest() throws Exception {
697
697
698
698
// First call returns 500, subsequent calls return 200
699
699
when (httpClientMock .send (expectedRequest (IMDS , ManagedIdentityTestConstants .RESOURCE )))
700
- .thenReturn (expectedResponse (500 , ManagedIdentityTestConstants .MSI_ERROR_RESPONSE_500 ))
701
- .thenReturn (expectedResponse (200 , getSuccessfulResponse (ManagedIdentityTestConstants .RESOURCE )));
700
+ .thenReturn (expectedResponse (HttpStatus . INTERNAL_SERVER_ERROR . getCode () , ManagedIdentityTestConstants .MSI_ERROR_RESPONSE_500 ))
701
+ .thenReturn (expectedResponse (HttpStatus . OK . getCode () , getSuccessfulResponse (ManagedIdentityTestConstants .RESOURCE )));
702
702
703
703
IAuthenticationResult result = acquireTokenCommon (ManagedIdentityTestConstants .RESOURCE ).get ();
704
704
@@ -710,7 +710,7 @@ void managedIdentityTest_RetriesARePerRequest() throws Exception {
710
710
711
711
//All calls return 500
712
712
when (httpClientMock .send (expectedRequest (IMDS , "otherResource" )))
713
- .thenReturn (expectedResponse (500 , ManagedIdentityTestConstants .MSI_ERROR_RESPONSE_500 ));
713
+ .thenReturn (expectedResponse (HttpStatus . INTERNAL_SERVER_ERROR . getCode () , ManagedIdentityTestConstants .MSI_ERROR_RESPONSE_500 ));
714
714
715
715
CompletableFuture <IAuthenticationResult > future = acquireTokenCommon ("otherResource" );
716
716
0 commit comments