Search in sources :

Example 6 with DefaultCcmV2JumpgateParameters

use of com.sequenceiq.cloudbreak.ccm.cloudinit.DefaultCcmV2JumpgateParameters in project cloudbreak by hortonworks.

the class CcmUserDataServiceTest method testFetchAndSaveCcmParametersWhenCcmV2JumpgateIsEnabled.

@Test
void testFetchAndSaveCcmParametersWhenCcmV2JumpgateIsEnabled() {
    Stack stack = getAStack();
    stack.setTunnel(Tunnel.CCMV2_JUMPGATE);
    DefaultCcmV2JumpgateParameters defaultCcmV2JumpgateParameters = mock(DefaultCcmV2JumpgateParameters.class);
    FreeIpa freeIpa = mock(FreeIpa.class);
    when(freeIpaService.findByStack(stack)).thenReturn(freeIpa);
    when(freeIpa.getDomain()).thenReturn("cldr.work.site");
    when(ccmV2JumpgateParameterSupplier.getCcmV2JumpgateParameters(anyString(), any(Optional.class), anyString(), anyString())).thenReturn(defaultCcmV2JumpgateParameters);
    when(defaultCcmV2JumpgateParameters.getAgentCrn()).thenReturn("testAgentCrn");
    when(hostDiscoveryService.determineGatewayFqdn(any(), any())).thenReturn("datahub.master0.cldr.work.site");
    CcmConnectivityParameters ccmParameters = ThreadBasedUserCrnProvider.doAs(TEST_USER_CRN, () -> underTest.fetchAndSaveCcmParameters(stack));
    assertEquals(CcmConnectivityMode.CCMV2_JUMPGATE, ccmParameters.getConnectivityMode(), "CCM V2 Jumpgate should be enabled.");
    assertEquals(defaultCcmV2JumpgateParameters, ccmParameters.getCcmV2JumpgateParameters(), "CCM V2 Jumpgate Parameters should match.");
    verify(ccmV2JumpgateParameterSupplier, times(1)).getCcmV2JumpgateParameters(anyString(), any(Optional.class), anyString(), anyString());
    verifyNoInteractions(ccmParameterSupplier);
    verify(stackService, times(1)).setCcmV2AgentCrnByStackId(100L, "testAgentCrn");
}
Also used : CcmConnectivityParameters(com.sequenceiq.cloudbreak.ccm.cloudinit.CcmConnectivityParameters) DefaultCcmV2JumpgateParameters(com.sequenceiq.cloudbreak.ccm.cloudinit.DefaultCcmV2JumpgateParameters) FreeIpa(com.sequenceiq.freeipa.entity.FreeIpa) Optional(java.util.Optional) Stack(com.sequenceiq.freeipa.entity.Stack) Test(org.junit.jupiter.api.Test)

Aggregations

DefaultCcmV2JumpgateParameters (com.sequenceiq.cloudbreak.ccm.cloudinit.DefaultCcmV2JumpgateParameters)6 CcmConnectivityParameters (com.sequenceiq.cloudbreak.ccm.cloudinit.CcmConnectivityParameters)5 Test (org.junit.jupiter.api.Test)3 CcmV2JumpgateParameters (com.sequenceiq.cloudbreak.ccm.cloudinit.CcmV2JumpgateParameters)2 Stack (com.sequenceiq.freeipa.entity.Stack)2 InvertingProxy (com.cloudera.thunderhead.service.clusterconnectivitymanagementv2.ClusterConnectivityManagementV2Proto.InvertingProxy)1 InvertingProxyAgent (com.cloudera.thunderhead.service.clusterconnectivitymanagementv2.ClusterConnectivityManagementV2Proto.InvertingProxyAgent)1 PlatformParameters (com.sequenceiq.cloudbreak.cloud.PlatformParameters)1 ScriptParams (com.sequenceiq.cloudbreak.cloud.model.ScriptParams)1 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)1 SaltConfig (com.sequenceiq.cloudbreak.orchestrator.model.SaltConfig)1 SaltPillarProperties (com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties)1 InstanceGroupType (com.sequenceiq.common.api.type.InstanceGroupType)1 FreeIpa (com.sequenceiq.freeipa.entity.FreeIpa)1 FreeIpaConfigView (com.sequenceiq.freeipa.service.freeipa.config.FreeIpaConfigView)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Test (org.junit.Test)1 DisplayName (org.junit.jupiter.api.DisplayName)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1