Search in sources :

Example 1 with ScriptParams

use of com.sequenceiq.cloudbreak.cloud.model.ScriptParams in project cloudbreak by hortonworks.

the class GcpPlatformParametersTest method testScriptParams.

@Test
public void testScriptParams() {
    ScriptParams scriptParams = underTest.scriptParams();
    Assert.assertEquals(scriptParams.getStartLabel(), Integer.valueOf(97));
    Assert.assertEquals(scriptParams.getDiskPrefix(), "sd");
}
Also used : ScriptParams(com.sequenceiq.cloudbreak.cloud.model.ScriptParams) Test(org.junit.jupiter.api.Test)

Example 2 with ScriptParams

use of com.sequenceiq.cloudbreak.cloud.model.ScriptParams in project cloudbreak by hortonworks.

the class UserDataBuilderTest method testBuildUserDataWithCCMV2JumpgateParams.

@ParameterizedTest(name = "Forced TLS mode = {0}, entitlement = {1}, filename = {2}")
@MethodSource("tlsCases")
@DisplayName("test if CCM V2 Jumpgate parameters are passed the user data contains them")
void testBuildUserDataWithCCMV2JumpgateParams(CcmV2TlsType ccmV2TlsType, boolean oneWayTlsEntitlementEnabled, String expectedContentFileName) throws IOException {
    CcmV2JumpgateParameters ccmV2JumpgateParameters = new DefaultCcmV2JumpgateParameters("invertingProxyHost", "invertingProxyCertificate", "agentCrn", "agentKeyId", "agentEncipheredPrivateKey", "agentCertificate", "environmentCrn", "agentMachineUserAccessKeyId", "agentMachineUserEncipheredAccessKey");
    CcmConnectivityParameters ccmConnectivityParameters = new CcmConnectivityParameters(ccmV2JumpgateParameters);
    PlatformParameters platformParameters = mock(PlatformParameters.class);
    ScriptParams scriptParams = mock(ScriptParams.class);
    when(scriptParams.getDiskPrefix()).thenReturn("sd");
    when(scriptParams.getStartLabel()).thenReturn(98);
    when(platformParameters.scriptParams()).thenReturn(scriptParams);
    lenient().when(entitlementService.ccmV2UseOneWayTls(ACCOUNT_ID)).thenReturn(oneWayTlsEntitlementEnabled);
    environment.setCcmV2TlsType(ccmV2TlsType);
    String userData = underTest.buildUserData(ACCOUNT_ID, environment, Platform.platform("AZURE"), "priv-key".getBytes(), "cloudbreak", platformParameters, "pass", "cert", ccmConnectivityParameters, null);
    String expectedUserData = FileReaderUtils.readFileFromClasspath(expectedContentFileName);
    assertEquals(expectedUserData, userData);
}
Also used : CcmConnectivityParameters(com.sequenceiq.cloudbreak.ccm.cloudinit.CcmConnectivityParameters) DefaultCcmV2JumpgateParameters(com.sequenceiq.cloudbreak.ccm.cloudinit.DefaultCcmV2JumpgateParameters) ScriptParams(com.sequenceiq.cloudbreak.cloud.model.ScriptParams) DefaultCcmV2JumpgateParameters(com.sequenceiq.cloudbreak.ccm.cloudinit.DefaultCcmV2JumpgateParameters) CcmV2JumpgateParameters(com.sequenceiq.cloudbreak.ccm.cloudinit.CcmV2JumpgateParameters) PlatformParameters(com.sequenceiq.cloudbreak.cloud.PlatformParameters) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource) DisplayName(org.junit.jupiter.api.DisplayName)

Example 3 with ScriptParams

use of com.sequenceiq.cloudbreak.cloud.model.ScriptParams in project cloudbreak by hortonworks.

the class UserDataBuilderTest method testBuildUserDataWithoutCCMParams.

@Test
@DisplayName("test if NO CCM parameters are passed the user data does not contain them")
void testBuildUserDataWithoutCCMParams() throws IOException {
    PlatformParameters platformParameters = mock(PlatformParameters.class);
    ScriptParams scriptParams = mock(ScriptParams.class);
    when(scriptParams.getDiskPrefix()).thenReturn("sd");
    when(scriptParams.getStartLabel()).thenReturn(98);
    when(platformParameters.scriptParams()).thenReturn(scriptParams);
    String userData = underTest.buildUserData(ACCOUNT_ID, environment, Platform.platform("AZURE"), "priv-key".getBytes(), "cloudbreak", platformParameters, "pass", "cert", new CcmConnectivityParameters(), null);
    String expectedUserData = FileReaderUtils.readFileFromClasspath("azure-init.sh");
    assertEquals(expectedUserData, userData);
}
Also used : CcmConnectivityParameters(com.sequenceiq.cloudbreak.ccm.cloudinit.CcmConnectivityParameters) ScriptParams(com.sequenceiq.cloudbreak.cloud.model.ScriptParams) PlatformParameters(com.sequenceiq.cloudbreak.cloud.PlatformParameters) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) DisplayName(org.junit.jupiter.api.DisplayName)

Example 4 with ScriptParams

use of com.sequenceiq.cloudbreak.cloud.model.ScriptParams in project cloudbreak by hortonworks.

the class UserDataBuilderTest method testBuildUserDataWithCCMParams.

@Test
@DisplayName("test if CCM parameters are passed the user data contains them")
void testBuildUserDataWithCCMParams() throws IOException {
    BaseServiceEndpoint serviceEndpoint = new BaseServiceEndpoint(new HostEndpoint("ccm.cloudera.com"));
    DefaultServerParameters serverParameters = new DefaultServerParameters(serviceEndpoint, "pub-key", "mina-id");
    DefaultInstanceParameters instanceParameters = new DefaultInstanceParameters("tunnel-id", "key-id", "private-key");
    DefaultTunnelParameters nginxTunnel = new DefaultTunnelParameters(KnownServiceIdentifier.GATEWAY, 9443);
    CcmParameters ccmParameters = new DefaultCcmParameters(serverParameters, instanceParameters, List.of(nginxTunnel));
    CcmConnectivityParameters ccmConnectivityParameters = new CcmConnectivityParameters(ccmParameters);
    ProxyAuthentication proxyAuthentication = ProxyAuthentication.builder().withUserName("user").withPassword("pwd").build();
    ProxyConfig proxyConfig = ProxyConfig.builder().withServerHost("proxy.host").withServerPort(1234).withProxyAuthentication(proxyAuthentication).withNoProxyHosts("noproxy.com").withProtocol("https").build();
    PlatformParameters platformParameters = mock(PlatformParameters.class);
    ScriptParams scriptParams = mock(ScriptParams.class);
    when(scriptParams.getDiskPrefix()).thenReturn("sd");
    when(scriptParams.getStartLabel()).thenReturn(98);
    when(platformParameters.scriptParams()).thenReturn(scriptParams);
    String userData = underTest.buildUserData(ACCOUNT_ID, environment, Platform.platform("AZURE"), "priv-key".getBytes(), "cloudbreak", platformParameters, "pass", "cert", ccmConnectivityParameters, proxyConfig);
    String expectedUserData = FileReaderUtils.readFileFromClasspath("azure-ccm-init.sh");
    assertEquals(expectedUserData, userData);
}
Also used : DefaultCcmParameters(com.sequenceiq.cloudbreak.ccm.cloudinit.DefaultCcmParameters) ProxyAuthentication(com.sequenceiq.cloudbreak.dto.ProxyAuthentication) ScriptParams(com.sequenceiq.cloudbreak.cloud.model.ScriptParams) ProxyConfig(com.sequenceiq.cloudbreak.dto.ProxyConfig) DefaultCcmParameters(com.sequenceiq.cloudbreak.ccm.cloudinit.DefaultCcmParameters) CcmParameters(com.sequenceiq.cloudbreak.ccm.cloudinit.CcmParameters) CcmConnectivityParameters(com.sequenceiq.cloudbreak.ccm.cloudinit.CcmConnectivityParameters) PlatformParameters(com.sequenceiq.cloudbreak.cloud.PlatformParameters) BaseServiceEndpoint(com.sequenceiq.cloudbreak.ccm.endpoint.BaseServiceEndpoint) DefaultInstanceParameters(com.sequenceiq.cloudbreak.ccm.cloudinit.DefaultInstanceParameters) HostEndpoint(com.sequenceiq.cloudbreak.ccm.endpoint.HostEndpoint) DefaultServerParameters(com.sequenceiq.cloudbreak.ccm.cloudinit.DefaultServerParameters) DefaultTunnelParameters(com.sequenceiq.cloudbreak.ccm.cloudinit.DefaultTunnelParameters) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) DisplayName(org.junit.jupiter.api.DisplayName)

Example 5 with ScriptParams

use of com.sequenceiq.cloudbreak.cloud.model.ScriptParams in project cloudbreak by hortonworks.

the class UserDataBuilderTest method testBuildUserDataWithCCMV2Params.

@Test
@DisplayName("test if CCM V2 parameters are passed the user data contains them")
void testBuildUserDataWithCCMV2Params() throws IOException {
    CcmV2Parameters ccmV2Parameters = new DefaultCcmV2Parameters("invertingProxyHost", "invertingProxyCertificate", "agentCrn", "agentKeyId", "agentEncipheredPrivateKey", "agentCertificate");
    CcmConnectivityParameters ccmConnectivityParameters = new CcmConnectivityParameters(ccmV2Parameters);
    PlatformParameters platformParameters = mock(PlatformParameters.class);
    ScriptParams scriptParams = mock(ScriptParams.class);
    when(scriptParams.getDiskPrefix()).thenReturn("sd");
    when(scriptParams.getStartLabel()).thenReturn(98);
    when(platformParameters.scriptParams()).thenReturn(scriptParams);
    String userData = underTest.buildUserData(ACCOUNT_ID, environment, Platform.platform("AZURE"), "priv-key".getBytes(), "cloudbreak", platformParameters, "pass", "cert", ccmConnectivityParameters, null);
    String expectedUserData = FileReaderUtils.readFileFromClasspath("azure-ccm-v2-init.sh");
    assertEquals(expectedUserData, userData);
}
Also used : CcmConnectivityParameters(com.sequenceiq.cloudbreak.ccm.cloudinit.CcmConnectivityParameters) DefaultCcmV2Parameters(com.sequenceiq.cloudbreak.ccm.cloudinit.DefaultCcmV2Parameters) ScriptParams(com.sequenceiq.cloudbreak.cloud.model.ScriptParams) PlatformParameters(com.sequenceiq.cloudbreak.cloud.PlatformParameters) CcmV2Parameters(com.sequenceiq.cloudbreak.ccm.cloudinit.CcmV2Parameters) DefaultCcmV2Parameters(com.sequenceiq.cloudbreak.ccm.cloudinit.DefaultCcmV2Parameters) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) DisplayName(org.junit.jupiter.api.DisplayName)

Aggregations

ScriptParams (com.sequenceiq.cloudbreak.cloud.model.ScriptParams)5 CcmConnectivityParameters (com.sequenceiq.cloudbreak.ccm.cloudinit.CcmConnectivityParameters)4 PlatformParameters (com.sequenceiq.cloudbreak.cloud.PlatformParameters)4 DisplayName (org.junit.jupiter.api.DisplayName)4 Test (org.junit.jupiter.api.Test)4 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)4 CcmParameters (com.sequenceiq.cloudbreak.ccm.cloudinit.CcmParameters)1 CcmV2JumpgateParameters (com.sequenceiq.cloudbreak.ccm.cloudinit.CcmV2JumpgateParameters)1 CcmV2Parameters (com.sequenceiq.cloudbreak.ccm.cloudinit.CcmV2Parameters)1 DefaultCcmParameters (com.sequenceiq.cloudbreak.ccm.cloudinit.DefaultCcmParameters)1 DefaultCcmV2JumpgateParameters (com.sequenceiq.cloudbreak.ccm.cloudinit.DefaultCcmV2JumpgateParameters)1 DefaultCcmV2Parameters (com.sequenceiq.cloudbreak.ccm.cloudinit.DefaultCcmV2Parameters)1 DefaultInstanceParameters (com.sequenceiq.cloudbreak.ccm.cloudinit.DefaultInstanceParameters)1 DefaultServerParameters (com.sequenceiq.cloudbreak.ccm.cloudinit.DefaultServerParameters)1 DefaultTunnelParameters (com.sequenceiq.cloudbreak.ccm.cloudinit.DefaultTunnelParameters)1 BaseServiceEndpoint (com.sequenceiq.cloudbreak.ccm.endpoint.BaseServiceEndpoint)1 HostEndpoint (com.sequenceiq.cloudbreak.ccm.endpoint.HostEndpoint)1 ProxyAuthentication (com.sequenceiq.cloudbreak.dto.ProxyAuthentication)1 ProxyConfig (com.sequenceiq.cloudbreak.dto.ProxyConfig)1 MethodSource (org.junit.jupiter.params.provider.MethodSource)1