Wait for the order to become valid

pull/55/head
Richard Körber 2017-12-05 23:24:36 +01:00
parent 827e1277ef
commit 6cfd898895
No known key found for this signature in database
GPG Key ID: AAB9FD19C78AA3E0
1 changed files with 22 additions and 1 deletions

View File

@ -157,7 +157,7 @@ public class OrderIT extends PebbleITBase {
.pollInterval(1, SECONDS)
.timeout(30, SECONDS)
.conditionEvaluationListener(cond -> updateAuth(auth))
.until(auth::getStatus, not(Status.PENDING));
.until(auth::getStatus, not(isOneOf(Status.PENDING, Status.PROCESSING)));
if (auth.getStatus() != Status.VALID) {
fail("Authorization failed");
@ -171,6 +171,13 @@ public class OrderIT extends PebbleITBase {
order.execute(encodedCsr);
await()
.pollInterval(1, SECONDS)
.timeout(30, SECONDS)
.conditionEvaluationListener(cond -> updateOrder(order))
.until(order::getStatus, not(isOneOf(Status.PENDING, Status.PROCESSING)));
Certificate certificate = order.getCertificate();
X509Certificate cert = certificate.getCertificate();
assertThat(cert, not(nullValue()));
@ -193,6 +200,20 @@ public class OrderIT extends PebbleITBase {
}
}
/**
* Safely updates the order, catching checked exceptions.
*
* @param order
* {@link Order} to update
*/
private void updateOrder(Order order) {
try {
order.update();
} catch (AcmeException ex) {
throw new AcmeLazyLoadingException(order, ex);
}
}
@FunctionalInterface
private static interface Validator {
Challenge prepare(Authorization auth) throws Exception;