use of org.jenkinsci.plugins.workflow.graphanalysis.MemoryFlowChunk in project blueocean-plugin by jenkinsci.
the class PipelineNodeTest method testBlockedStep.
@Test
public void testBlockedStep() throws Exception {
String script = "node {\n" + " stage(\"one\"){\n" + " echo '1'\n" + " }\n" + " stage(\"two\") {\n" + " node('blah'){\n" + " sh 'blah'\n" + " }\n" + " }\n" + "\n" + "}";
WorkflowJob job1 = j.jenkins.createProject(WorkflowJob.class, "pipeline1");
job1.setDefinition(new CpsFlowDefinition(script, false));
QueueTaskFuture<WorkflowRun> runQueueTaskFuture = job1.scheduleBuild2(0);
WorkflowRun run = runQueueTaskFuture.getStartCondition().get();
CpsFlowExecution e = (CpsFlowExecution) run.getExecutionPromise().get();
if (waitForItemToAppearInQueue(1000 * 300)) {
// 5 min timeout
List<FlowNode> nodes = getStages(NodeGraphBuilder.NodeGraphBuilderFactory.getInstance(run));
if (nodes.size() == 2) {
List<Map> stepsResp = get("/organizations/jenkins/pipelines/pipeline1/runs/1/nodes/11/steps/", List.class);
assertEquals(1, stepsResp.size());
assertEquals("QUEUED", stepsResp.get(0).get("state"));
}
} else {
// Avoid spurious code coverage failures
final FlowNode node = new FlowNode(null, "fake") {
@Override
protected String getTypeDisplayName() {
return "fake";
}
};
final MemoryFlowChunk chunk = new MemoryFlowChunk() {
@Override
public FlowNode getFirstNode() {
return node;
}
};
new PipelineStepVisitor.LocalAtomNode(chunk, "fake");
}
}
Aggregations