mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
fix(acm): report SUCCESS domain validation once a certificate is issued (#3112)
DescribeCertificate returned Status ISSUED together with DomainValidationOptions[].ValidationStatus PENDING_VALIDATION for every public certificate, forever. Clients that wait on the validation status rather than the certificate status never finished: the AWS SDK CertificateValidated waiter polls only ValidationStatus, and the CDK DnsValidatedCertificate custom resource uses that waiter, so its stack waited for the Lambda's timeout and rolled back. The validation status now follows issuance: SUCCESS on an ISSUED certificate, PENDING_VALIDATION while the configured validation wait is running. A pending certificate is issued, with its validations marked SUCCESS and the change stored, on the first read after validation-wait-seconds has passed; before this the documented transition never happened.
This commit is contained in:
1 parent
c67e598594
commit
9b28388d89
5 files changed
+283
-11
No files matched your search
@@ -9,6 +9,8 @@ import org.junit.jupiter.api.Order;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestMethodOrder;
|
||||
import software.amazon.awssdk.core.SdkBytes;
|
||||
import software.amazon.awssdk.core.retry.backoff.FixedDelayBackoffStrategy;
|
||||
import software.amazon.awssdk.core.waiters.WaiterResponse;
|
||||
import software.amazon.awssdk.services.acm.AcmClient;
|
||||
import software.amazon.awssdk.services.acm.model.*;
|
||||
|
||||
@@ -18,6 +20,7 @@ import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.security.cert.CertificateFactory;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -120,6 +123,26 @@ class AcmTest {
|
||||
assertThat(detail.statusAsString()).isNotNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(2)
|
||||
@DisplayName("CertificateValidated waiter completes for an issued certificate")
|
||||
void testCertificateValidatedWaiterCompletes() {
|
||||
Assumptions.assumeTrue(requestedCertArn != null, "RequestCertificate must succeed first");
|
||||
Assumptions.assumeFalse(TestFixtures.isRealAws(), "real ACM waits for DNS validation");
|
||||
|
||||
// The waiter polls DomainValidationOptions[].ValidationStatus, as the CDK
|
||||
// DnsValidatedCertificate handler does, and never returns while any domain is pending.
|
||||
WaiterResponse<DescribeCertificateResponse> waited = acm.waiter().waitUntilCertificateValidated(
|
||||
b -> b.certificateArn(requestedCertArn),
|
||||
o -> o.maxAttempts(3).backoffStrategy(FixedDelayBackoffStrategy.create(Duration.ofSeconds(1))));
|
||||
|
||||
CertificateDetail detail = waited.matched().response().orElseThrow().certificate();
|
||||
assertThat(detail.status()).isEqualTo(CertificateStatus.ISSUED);
|
||||
assertThat(detail.domainValidationOptions()).isNotEmpty();
|
||||
assertThat(detail.domainValidationOptions())
|
||||
.allSatisfy(v -> assertThat(v.validationStatus()).isEqualTo(DomainStatus.SUCCESS));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(3)
|
||||
@DisplayName("Get a certificate whose chain validates it")
|
||||
|
||||
Reference in new issue
Block a user