@Test void testRenewCertificateWhenCertGenerationIsTriggerableButGenerationFailsAndDnsEntryShouldNotBeUpdated() { SecurityConfig securityConfig = new SecurityConfig(); securityConfig.setUserFacingCert("CERT"); securityConfig.setUserFacingKey("KEY"); Cluster cluster = TestUtil.cluster(); cluster.setFqdn("aNiceShortHostname.testdomain"); Stack stack = cluster.getStack(); stack.setSecurityConfig(securityConfig); stack.setCluster(cluster); boolean result = ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> underTest.renewCertificate(stack)); verify(environmentClientService, times(1)).getByCrn(anyString()); Mockito.verifyNoMoreInteractions(environmentClientService); Mockito.verifyNoMoreInteractions(domainNameProvider); Mockito.verifyNoMoreInteractions(dnsManagementService); Mockito.verifyNoMoreInteractions(securityConfigService); Assertions.assertEquals(Boolean.FALSE, result); }
public boolean renewCertificate(Stack stack) { boolean result = true; if (isCertRenewalTriggerable(stack)) { LOGGER.info("Renew certificate for stack: '{}'", stack.getName()); result = generateCertAndSaveForStack(stack); if (StringUtils.isEmpty(stack.getCluster().getFqdn())) { LOGGER.info("The cluster doesn't have public DNS entry, starting to create one."); updateDnsEntryForCluster(stack); } } return result; }
GatewayPublicEndpointManagementService extends BasePublicEndpointManagementService { public boolean renewCertificate(Stack stack) { boolean result = true; if (isCertRenewalTriggerable(stack)) { LOGGER.info("Renew certificate for stack: '{}'", stack.getName()); result = generateCertAndSaveForStack(stack); if (StringUtils.isEmpty(stack.getCluster().getFqdn())) { LOGGER.info("The cluster doesn't have public DNS entry, starting to create one."); updateDnsEntryForCluster(stack); } } return result; } }
GatewayPublicEndpointManagementService extends BasePublicEndpointManagementService { public boolean renewCertificate(Stack stack) { boolean result = true; if (isCertRenewalTriggerable(stack)) { LOGGER.info("Renew certificate for stack: '{}'", stack.getName()); result = generateCertAndSaveForStack(stack); if (StringUtils.isEmpty(stack.getCluster().getFqdn())) { LOGGER.info("The cluster doesn't have public DNS entry, starting to create one."); updateDnsEntryForCluster(stack); } } return result; }  }
GatewayPublicEndpointManagementService extends BasePublicEndpointManagementService { public boolean renewCertificate(Stack stack) { boolean result = true; if (isCertRenewalTriggerable(stack)) { LOGGER.info("Renew certificate for stack: '{}'", stack.getName()); result = generateCertAndSaveForStack(stack); if (StringUtils.isEmpty(stack.getCluster().getFqdn())) { LOGGER.info("The cluster doesn't have public DNS entry, starting to create one."); updateDnsEntryForCluster(stack); } } return result; }  boolean isCertRenewalTriggerable(Stack stack); boolean generateCertAndSaveForStackAndUpdateDnsEntry(Stack stack); String updateDnsEntry(Stack stack, String gatewayIp); String deleteDnsEntry(Stack stack, String environmentName); boolean renewCertificate(Stack stack); }
GatewayPublicEndpointManagementService extends BasePublicEndpointManagementService { public boolean renewCertificate(Stack stack) { boolean result = true; if (isCertRenewalTriggerable(stack)) { LOGGER.info("Renew certificate for stack: '{}'", stack.getName()); result = generateCertAndSaveForStack(stack); if (StringUtils.isEmpty(stack.getCluster().getFqdn())) { LOGGER.info("The cluster doesn't have public DNS entry, starting to create one."); updateDnsEntryForCluster(stack); } } return result; }  boolean isCertRenewalTriggerable(Stack stack); boolean generateCertAndSaveForStackAndUpdateDnsEntry(Stack stack); String updateDnsEntry(Stack stack, String gatewayIp); String deleteDnsEntry(Stack stack, String environmentName); boolean renewCertificate(Stack stack);  }