microsoft / Partner-Center-Java

Partner Center SDK for Java
https://docs.microsoft.com/java/partnercenter/
31 stars 12 forks source link

Infinite Loop when using a retriable error code in PartnerServiceRetryStrategy.java #152

Open Isra1997 opened 4 months ago

Isra1997 commented 4 months ago

Steps to reproduce

 @Test
  void createAndPersistMsShoppingCart_withErrorCodeConflict_shouldThrowException() {
    // Arrange
    var cart = testData.buildCart();
    expectPostMethod("/v1/customers/" + customerId + "/carts", null, HttpStatus.SERVICE_UNAVAILABLE);

    // Act/Assert
    Assertions.assertThrows(
        RemoteServiceException.class,
        () ->
            msPartnerOperationsService.createAndPersistMsShoppingCart(
                FLOW_ID, MS_CUSTOMER_ID, cart));
  }

Expected behavior

Retry three times and then fails with a PartnerException.

Actual behavior

Goes into an infinite loop because of line 66 in PartnerServiceRetryStrategy.java

Diagnostic logs

Please share test platform diagnostics logs.
None The logs may contain test assembly paths, kindly review and mask those before sharing. None

Environment

Please share additional details about your environment. Windows 10 Version 1.15.3