Search in sources :

Example 1 with UnhealthyInstances

use of com.sequenceiq.cloudbreak.service.stack.repair.UnhealthyInstances in project cloudbreak by hortonworks.

the class ReactorFlowManagerTest method shouldReturnTheNextFailureTransition.

@Test
public void shouldReturnTheNextFailureTransition() {
    InstanceGroupAdjustmentJson instanceGroupAdjustment = new InstanceGroupAdjustmentJson();
    HostGroupAdjustmentJson hostGroupAdjustment = new HostGroupAdjustmentJson();
    underTest.triggerProvisioning(stackId);
    underTest.triggerClusterInstall(stackId);
    underTest.triggerClusterReInstall(stackId);
    underTest.triggerStackStop(stackId);
    underTest.triggerStackStart(stackId);
    underTest.triggerClusterStop(stackId);
    underTest.triggerClusterStart(stackId);
    underTest.triggerTermination(stackId, false, false);
    underTest.triggerTermination(stackId, false, true);
    underTest.triggerStackUpscale(stackId, instanceGroupAdjustment, true);
    underTest.triggerStackDownscale(stackId, instanceGroupAdjustment);
    underTest.triggerStackRemoveInstance(stackId, "hostgroup", "hostname");
    underTest.triggerClusterUpscale(stackId, hostGroupAdjustment);
    underTest.triggerClusterDownscale(stackId, hostGroupAdjustment);
    underTest.triggerClusterSync(stackId);
    underTest.triggerStackSync(stackId);
    underTest.triggerFullSync(stackId);
    underTest.triggerClusterCredentialReplace(stackId, "admin", "admin1");
    underTest.triggerClusterCredentialUpdate(stackId, "admin1");
    underTest.triggerClusterTermination(stackId, false, false);
    underTest.triggerClusterTermination(stackId, true, false);
    underTest.triggerClusterUpgrade(stackId);
    underTest.triggerManualRepairFlow(stackId);
    underTest.triggerStackRepairFlow(stackId, new UnhealthyInstances());
    underTest.triggerClusterRepairFlow(stackId, new HashMap<>(), true);
    underTest.triggerEphemeralUpdate(stackId);
    // Not start from 0 because flow cancellations
    int count = 5;
    for (Method method : underTest.getClass().getDeclaredMethods()) {
        if (method.getName().startsWith("trigger")) {
            count++;
        }
    }
    verify(reactor, times(count)).notify((Object) anyObject(), any(Event.class));
}
Also used : UnhealthyInstances(com.sequenceiq.cloudbreak.service.stack.repair.UnhealthyInstances) Event(reactor.bus.Event) ClusterTerminationEvent(com.sequenceiq.cloudbreak.core.flow2.cluster.termination.ClusterTerminationEvent) HostGroupAdjustmentJson(com.sequenceiq.cloudbreak.api.model.HostGroupAdjustmentJson) InstanceGroupAdjustmentJson(com.sequenceiq.cloudbreak.api.model.InstanceGroupAdjustmentJson) Method(java.lang.reflect.Method) Test(org.junit.Test)

Example 2 with UnhealthyInstances

use of com.sequenceiq.cloudbreak.service.stack.repair.UnhealthyInstances in project cloudbreak by hortonworks.

the class StackRepairFlowEventChainFactory method createFlowTriggerEventQueue.

@Override
public Queue<Selectable> createFlowTriggerEventQueue(StackRepairTriggerEvent event) {
    Queue<Selectable> flowChainTriggers = new ConcurrentLinkedDeque<>();
    flowChainTriggers.add(new StackEvent(FlowChainTriggers.FULL_SYNC_TRIGGER_EVENT, event.getStackId(), event.accepted()));
    UnhealthyInstances unhealthyInstances = event.getUnhealthyInstances();
    String fullUpscaleTriggerEvent = FlowChainTriggers.FULL_UPSCALE_TRIGGER_EVENT;
    for (String hostGroupName : unhealthyInstances.getHostGroups()) {
        List<String> instances = unhealthyInstances.getInstancesForGroup(hostGroupName);
        flowChainTriggers.add(new StackAndClusterUpscaleTriggerEvent(fullUpscaleTriggerEvent, event.getStackId(), hostGroupName, instances.size(), ScalingType.UPSCALE_TOGETHER));
    }
    return flowChainTriggers;
}
Also used : StackAndClusterUpscaleTriggerEvent(com.sequenceiq.cloudbreak.core.flow2.event.StackAndClusterUpscaleTriggerEvent) StackEvent(com.sequenceiq.cloudbreak.reactor.api.event.StackEvent) Selectable(com.sequenceiq.cloudbreak.cloud.event.Selectable) UnhealthyInstances(com.sequenceiq.cloudbreak.service.stack.repair.UnhealthyInstances) ConcurrentLinkedDeque(java.util.concurrent.ConcurrentLinkedDeque)

Aggregations

UnhealthyInstances (com.sequenceiq.cloudbreak.service.stack.repair.UnhealthyInstances)2 HostGroupAdjustmentJson (com.sequenceiq.cloudbreak.api.model.HostGroupAdjustmentJson)1 InstanceGroupAdjustmentJson (com.sequenceiq.cloudbreak.api.model.InstanceGroupAdjustmentJson)1 Selectable (com.sequenceiq.cloudbreak.cloud.event.Selectable)1 ClusterTerminationEvent (com.sequenceiq.cloudbreak.core.flow2.cluster.termination.ClusterTerminationEvent)1 StackAndClusterUpscaleTriggerEvent (com.sequenceiq.cloudbreak.core.flow2.event.StackAndClusterUpscaleTriggerEvent)1 StackEvent (com.sequenceiq.cloudbreak.reactor.api.event.StackEvent)1 Method (java.lang.reflect.Method)1 ConcurrentLinkedDeque (java.util.concurrent.ConcurrentLinkedDeque)1 Test (org.junit.Test)1 Event (reactor.bus.Event)1