use of com.sequenceiq.it.cloudbreak.context.Description in project cloudbreak by hortonworks.
the class SdxRangerRazEnabledTests method testCreateSdxWithoutRangerRaz.
@Test(dataProvider = TEST_CONTEXT)
@Description(given = "there is a running Cloudbreak", when = "enableRangerRaz is called when Raz is not installed", then = "Exception is thrown")
public void testCreateSdxWithoutRangerRaz(TestContext testContext) {
String sdx = resourcePropertyProvider().getName();
SdxDatabaseRequest sdxDatabaseRequest = new SdxDatabaseRequest();
sdxDatabaseRequest.setAvailabilityType(SdxDatabaseAvailabilityType.NONE);
testContext.given(SdxTestDto.class).withExternalDatabase(sdxDatabaseRequest).withCloudStorage(getCloudStorageRequest(testContext)).when(sdxTestClient.create(), key(sdx)).await(SdxClusterStatusResponse.RUNNING).awaitForHealthyInstances().whenException(sdxTestClient.enableRangerRaz(), BadRequestException.class).validate();
}
use of com.sequenceiq.it.cloudbreak.context.Description in project cloudbreak by hortonworks.
the class SdxSecurityTests method testSDXAutoTlsCertRotation.
@Test(dataProvider = TEST_CONTEXT)
@UseSpotInstances
@Description(given = "there is a running Cloudbreak, and an SDX cluster in available state", when = "autotls cert rotation is called on the SDX cluster", then = "host certificates' validity should be changed on all hosts, the cluster should be up and running")
public void testSDXAutoTlsCertRotation(TestContext testContext) {
String sdx = resourcePropertyProvider().getName();
List<String> originalCertValidityOutput = new ArrayList<>();
List<String> renewedCertValidityOutput = new ArrayList<>();
SdxDatabaseRequest noDatabaseRequest = new SdxDatabaseRequest();
noDatabaseRequest.setAvailabilityType(SdxDatabaseAvailabilityType.NONE);
testContext.given(sdx, SdxTestDto.class).withCloudStorage().withExternalDatabase(noDatabaseRequest).when(sdxTestClient.create(), key(sdx)).await(SdxClusterStatusResponse.RUNNING, key(sdx)).awaitForHealthyInstances().then((tc, testDto, client) -> {
Map<String, Pair<Integer, String>> certValidityCmdResultByIpsMap = sshJClientActions.executeSshCommandOnHost(getInstanceGroups(testDto, client), List.of(HostGroupType.MASTER.getName(), HostGroupType.IDBROKER.getName()), HOST_CERT_VALIDITY_CMD, false);
originalCertValidityOutput.addAll(certValidityCmdResultByIpsMap.values().stream().map(Pair::getValue).collect(Collectors.toList()));
return testDto;
}).when(sdxTestClient.rotateAutotlsCertificates(), key(sdx)).await(SdxClusterStatusResponse.CERT_ROTATION_IN_PROGRESS, key(sdx).withWaitForFlow(false)).await(SdxClusterStatusResponse.RUNNING, key(sdx)).awaitForHealthyInstances().then((tc, testDto, client) -> {
Map<String, Pair<Integer, String>> certValidityCmdResultByIpsMap = sshJClientActions.executeSshCommandOnHost(getInstanceGroups(testDto, client), List.of(HostGroupType.MASTER.getName(), HostGroupType.IDBROKER.getName()), HOST_CERT_VALIDITY_CMD, false);
renewedCertValidityOutput.addAll(certValidityCmdResultByIpsMap.entrySet().stream().map(e -> e.getValue().getValue()).collect(Collectors.toList()));
return testDto;
}).then((tc, testDto, client) -> compareCertValidityOutputs(testDto, originalCertValidityOutput, renewedCertValidityOutput)).validate();
}
use of com.sequenceiq.it.cloudbreak.context.Description in project cloudbreak by hortonworks.
the class MultiThreadTenantTest method collectTestCaseDescription.
private TestCaseDescription collectTestCaseDescription(MockedTestContext testContext, Method method, Object[] params) {
Description declaredAnnotation = method.getDeclaredAnnotation(Description.class);
TestCaseDescription testCaseDescription = null;
if (declaredAnnotation != null) {
testCaseDescription = new TestCaseDescriptionBuilder().given(declaredAnnotation.given()).when(declaredAnnotation.when()).then(declaredAnnotation.then());
testContext.addDescription(testCaseDescription);
} else if (method.getParameters().length == params.length) {
Parameter[] parameters = method.getParameters();
for (int i = 1; i < parameters.length; i++) {
if (parameters[i].getAnnotation(Description.class) != null) {
Object param = params[i];
if (!(param instanceof TestCaseDescription)) {
throw new IllegalArgumentException("The param annotated with @Description but the type is should be " + TestCaseDescription.class.getSimpleName());
}
testCaseDescription = (TestCaseDescription) param;
testContext.addDescription(testCaseDescription);
break;
}
}
}
return Optional.ofNullable(testCaseDescription).filter(d -> !Strings.isNullOrEmpty(d.getValue())).orElseThrow(() -> new TestCaseDescriptionMissingException(method.getName()));
}
use of com.sequenceiq.it.cloudbreak.context.Description in project cloudbreak by hortonworks.
the class RecipeClusterTest method testWhenClusterGetUpScaledThenPostClusterInstallRecipeShouldBeExecuted.
@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "a created cluster with post ambari install recipe", when = "upscaling cluster", then = "the post recipe should run on the new nodes as well")
public void testWhenClusterGetUpScaledThenPostClusterInstallRecipeShouldBeExecuted(MockedTestContext testContext) {
ApiParcel parcel = parcelGeneratorUtil.getActivatedCDHParcel();
String clusterName = resourcePropertyProvider.getName();
parcelMockActivatorUtil.mockActivateWithDefaultParcels(testContext, clusterName, parcel);
String recipeName = resourcePropertyProvider().getName();
testContext.given(RecipeTestDto.class).withName(recipeName).withContent(RECIPE_CONTENT).withRecipeType(POST_CLUSTER_INSTALL).when(recipeTestClient.createV4()).given(INSTANCE_GROUP_ID, InstanceGroupTestDto.class).withHostGroup(HostGroupType.WORKER).withNodeCount(NODE_COUNT).withRecipes(recipeName).given("computeIg", InstanceGroupTestDto.class).withHostGroup(HostGroupType.COMPUTE).withNodeCount(NODE_COUNT).withRecipes(recipeName).given("cmpkey", ClouderaManagerProductTestDto.class).withParcel("someParcel").withName(parcel.getProduct()).withVersion(parcel.getVersion()).given("cmanager", ClouderaManagerTestDto.class).withClouderaManagerProduct("cmpkey").given("cmpclusterkey", ClusterTestDto.class).withClouderaManager("cmanager").given(StackTestDto.class).withName(clusterName).replaceInstanceGroups(INSTANCE_GROUP_ID).withCluster("cmpclusterkey").when(stackTestClient.createV4()).enableVerification().await(STACK_AVAILABLE).when(StackScalePostAction.valid().withDesiredCount(4)).await(STACK_AVAILABLE, pollingInterval(POLLING_INTERVAL)).mockSalt().run().post().bodyContains(HIGHSTATE, 1).atLeast(1).verify().validate();
}
use of com.sequenceiq.it.cloudbreak.context.Description in project cloudbreak by hortonworks.
the class RecipeClusterTest method testWhenRecipeProvidedToHostGroupAndAnotherHostGroupGetUpScaledThenThereIsNoFurtherRecipeExecutionOnTheNewNodeBesideTheDefaultOnes.
@Test(dataProvider = TEST_CONTEXT_WITH_MOCK)
@Description(given = "a created cluster with post ambari recipe", when = "upscaling cluster on hostgroup which has no post install recipe", then = "the post recipe should not run on the new nodes because those recipe not configured on the upscaled hostgroup")
public void testWhenRecipeProvidedToHostGroupAndAnotherHostGroupGetUpScaledThenThereIsNoFurtherRecipeExecutionOnTheNewNodeBesideTheDefaultOnes(MockedTestContext testContext) {
ApiParcel parcel = parcelGeneratorUtil.getActivatedCDHParcel();
String recipeName = resourcePropertyProvider().getName();
String clusterName = resourcePropertyProvider.getName();
parcelMockActivatorUtil.mockActivateWithDefaultParcels(testContext, clusterName, parcel);
testContext.given(RecipeTestDto.class).withName(recipeName).withContent(RECIPE_CONTENT).withRecipeType(POST_CLOUDERA_MANAGER_START).when(recipeTestClient.createV4()).given(INSTANCE_GROUP_ID, InstanceGroupTestDto.class).withHostGroup(HostGroupType.COMPUTE).withNodeCount(NODE_COUNT).withRecipes(recipeName).given("cmpkey", ClouderaManagerProductTestDto.class).withParcel("someParcel").withName(parcel.getProduct()).withVersion(parcel.getVersion()).given("cmanager", ClouderaManagerTestDto.class).withClouderaManagerProduct("cmpkey").given("cmpclusterkey", ClusterTestDto.class).withClouderaManager("cmanager").given(StackTestDto.class).withName(clusterName).replaceInstanceGroups(INSTANCE_GROUP_ID).withCluster("cmpclusterkey").when(stackTestClient.createV4()).enableVerification().await(STACK_AVAILABLE).when(StackScalePostAction.valid().withDesiredCount(4)).await(STACK_AVAILABLE, pollingInterval(POLLING_INTERVAL)).mockSalt().run().post().bodyContains(HIGHSTATE, 1).atLeast(1).verify().validate();
}
Aggregations