use of org.jenkinsci.plugins.workflow.graph.FlowGraphWalker in project workflow-cps-plugin by jenkinsci.
the class CpsScmFlowDefinitionTest method basics.
@Test
public void basics() throws Exception {
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
CpsScmFlowDefinition def = new CpsScmFlowDefinition(new SingleFileSCM("flow.groovy", "echo 'hello from SCM'"), "flow.groovy");
// currently the default, but just to be clear that we do rely on that in this test
def.setLightweight(false);
p.setDefinition(def);
WorkflowRun b = r.assertBuildStatusSuccess(p.scheduleBuild2(0));
// TODO currently the log text is in Run.log, but not on FlowStartNode/LogAction, so not visible from Workflow Steps etc.
r.assertLogContains("hello from SCM", b);
r.assertLogContains("Staging flow.groovy", b);
r.assertLogNotContains("Retrying after 10 seconds", b);
FlowGraphWalker w = new FlowGraphWalker(b.getExecution());
int workspaces = 0;
for (FlowNode n : w) {
if (n.getAction(WorkspaceAction.class) != null) {
workspaces++;
}
}
assertEquals(1, workspaces);
}
Aggregations