Skip to content

Commit

Permalink
test: fix flakiness
Browse files Browse the repository at this point in the history
Signed-off-by: Pierre-Alexandre Meyer <[email protected]>
  • Loading branch information
pierre committed Aug 31, 2024
1 parent f77e7b6 commit a7e5ef1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@
<artifactId>org.apache.felix.framework</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jooby</groupId>
<artifactId>jooby</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

import org.awaitility.Awaitility;
import org.joda.time.Period;
import org.killbill.billing.ObjectType;
import org.killbill.billing.catalog.api.Currency;
Expand Down Expand Up @@ -537,11 +540,16 @@ public void testExpired3DSPurchase() throws PaymentPluginApiException, StripeExc
// See getPending3DsPaymentExpirationPeriod
clock.addDeltaFromReality(new Period("PT3H").toStandardDuration().getMillis());

final List<PaymentTransactionInfoPlugin> paymentTransactionInfoPluginExpired = stripePaymentPluginApi.getPaymentInfo(account.getId(),
payment.getId(),
ImmutableList.of(),
context);
assertEquals(paymentTransactionInfoPluginExpired.get(0).getStatus(), PaymentPluginStatus.CANCELED);
Awaitility.await().atMost(5, TimeUnit.SECONDS).until(new Callable<>() {
@Override
public Boolean call() throws Exception {
final List<PaymentTransactionInfoPlugin> paymentTransactionInfoPluginExpired = stripePaymentPluginApi.getPaymentInfo(account.getId(),
payment.getId(),
ImmutableList.of(),
context);
return PaymentPluginStatus.CANCELED.equals(paymentTransactionInfoPluginExpired.get(0).getStatus());
}
});
}

@Test(groups = "integration")
Expand Down

0 comments on commit a7e5ef1

Please sign in to comment.