use of com.redhat.devtools.intellij.tektoncd.utils.model.actions.AddTriggerModel in project intellij-tekton by redhat-developer.
the class YAMLBuilderTest method checkPipelineRunCreatedHasWorkspace.
@Test
public void checkPipelineRunCreatedHasWorkspace() throws IOException {
String content = load("pipeline5.yaml");
AddTriggerModel model = new AddTriggerModel(content, Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), Collections.emptyMap());
if (model.getWorkspaces().containsKey("password-vault")) {
model.getWorkspaces().put("password-vault", new Workspace("foo1", Workspace.Kind.EMPTYDIR, "foo"));
}
if (model.getWorkspaces().containsKey("recipe-store")) {
model.getWorkspaces().put("recipe-store", new Workspace("foo2", Workspace.Kind.EMPTYDIR, "foo"));
}
ObjectNode pipelineRunNode = YAMLBuilder.createPipelineRun(model);
assertEquals(pipelineRunNode.get("apiVersion").asText(), "tekton.dev/v1beta1");
assertEquals(pipelineRunNode.get("kind").asText(), "PipelineRun");
assertEquals(pipelineRunNode.get("metadata").get("generateName").asText(), "foo-");
assertEquals(pipelineRunNode.get("spec").get("pipelineRef").get("name").asText(), "foo");
assertFalse(pipelineRunNode.get("spec").has("serviceAccountName"));
assertFalse(pipelineRunNode.get("spec").has("serviceAccountNames"));
assertFalse(pipelineRunNode.get("spec").has("params"));
assertFalse(pipelineRunNode.get("spec").has("resources"));
assertTrue(pipelineRunNode.get("spec").has("workspaces"));
assertEquals(pipelineRunNode.get("spec").get("workspaces").get(0).get("name").asText(), "foo1");
assertEquals(pipelineRunNode.get("spec").get("workspaces").get(1).get("name").asText(), "foo2");
}
Aggregations