use of com.sequenceiq.sdx.api.model.SdxClusterShape.LIGHT_DUTY in project cloudbreak by hortonworks.
the class SdxRecommendationServiceTest method testGetRecommendation.
@Test
public void testGetRecommendation() {
when(cdpConfigService.getConfigForKey(any())).thenReturn(createStackRequest());
when(environmentClientService.getVmTypesByCredential(anyString(), anyString(), anyString(), eq(CdpResourceType.DATALAKE), any())).thenReturn(createPlatformVmtypesResponse());
SdxRecommendationResponse recommendation = underTest.getRecommendation("cred", LIGHT_DUTY, "7.2.14", "AWS", "ec-central-1", null);
StackV4Request defaultTemplate = recommendation.getTemplate();
assertNotNull(defaultTemplate);
assertThat(defaultTemplate.getInstanceGroups()).hasSize(2).extracting(ig -> ig.getName(), ig -> ig.getTemplate().getInstanceType()).containsExactlyInAnyOrder(tuple("master", "large"), tuple("idbroker", "medium"));
Map<String, List<com.sequenceiq.sdx.api.model.VmTypeResponse>> availableVmTypesByInstanceGroup = recommendation.getAvailableVmTypesByInstanceGroup();
assertThat(availableVmTypesByInstanceGroup).containsOnlyKeys("master", "idbroker");
assertThat(availableVmTypesByInstanceGroup.get("master")).extracting(vmType -> vmType.getValue()).containsExactlyInAnyOrder("large");
assertThat(availableVmTypesByInstanceGroup.get("idbroker")).extracting(vmType -> vmType.getValue()).containsExactlyInAnyOrder("large", "medium", "mediumv2");
}
Aggregations