use of com.google.copybara.testing.RecordsProcessCallDestination.ProcessedChange in project copybara by google.
the class WorkflowTest method changeRequestWorkflowTestRecordContextReference.
@Test
public void changeRequestWorkflowTestRecordContextReference() throws Exception {
origin.addSimpleChange(0, "One Change\n" + destination.getLabelNameWhenOrigin() + "=42").addSimpleChange(1, "Second Change");
Workflow<?, ?> workflow = changeRequestWorkflow(null);
workflow.run(workdir, ImmutableList.of("HEAD"));
ProcessedChange change = destination.processed.get(0);
assertThat(change.getBaseline()).isEqualTo("42");
assertThat(change.getRequestedRevision().contextReference()).isEqualTo("HEAD");
}
use of com.google.copybara.testing.RecordsProcessCallDestination.ProcessedChange in project copybara by google.
the class WorkflowTest method squashWorkflowTestRecordContextReference.
@Test
public void squashWorkflowTestRecordContextReference() throws Exception {
origin.addSimpleChange(/*timestamp*/
1);
transformations = ImmutableList.of();
Workflow<?, ?> workflow = workflow();
workflow.run(workdir, ImmutableList.of("HEAD"));
ProcessedChange change = Iterables.getOnlyElement(destination.processed);
assertThat(change.getRequestedRevision().contextReference()).isEqualTo("HEAD");
}
use of com.google.copybara.testing.RecordsProcessCallDestination.ProcessedChange in project copybara by google.
the class WorkflowTest method iterativeWorkflowTestRecordMigrationKey.
@Test
public void iterativeWorkflowTestRecordMigrationKey() throws Exception {
for (int timestamp = 0; timestamp < 10; timestamp++) {
origin.addSimpleChange(timestamp);
}
String name = "notDefaultWorkflow";
Workflow<?, ?> workflow = iterativeWorkflow(name, "0");
workflow.run(workdir, ImmutableList.of("1"));
workflow = iterativeWorkflow(name, null);
workflow.run(workdir, ImmutableList.of("HEAD"));
for (ProcessedChange change : destination.processed) {
assertThat(change.getWorkflowName()).isEqualTo(name);
}
}
use of com.google.copybara.testing.RecordsProcessCallDestination.ProcessedChange in project copybara by google.
the class WorkflowTest method testMessageTransformerForIterative.
@Test
public void testMessageTransformerForIterative() throws Exception {
runWorkflowForMessageTransform(WorkflowMode.ITERATIVE, /*thirdTransform=*/
null);
ProcessedChange secondCommit = destination.processed.get(0);
assertThat(secondCommit.getChangesSummary()).isEqualTo("" + "CHANGE: second commit (1) by Foo Bar\n" + "\n" + "BAR = foo\n");
assertThat(secondCommit.getAuthor().toString()).isEqualTo("Someone <someone@somewhere.com>");
ProcessedChange thirdCommit = destination.processed.get(1);
assertThat(thirdCommit.getChangesSummary()).isEqualTo("" + "CHANGE: third commit (2) by Foo Baz\n" + "\n" + "BAR = foo\n");
assertThat(thirdCommit.getAuthor().toString()).isEqualTo("Someone <someone@somewhere.com>");
}
use of com.google.copybara.testing.RecordsProcessCallDestination.ProcessedChange in project copybara by google.
the class WorkflowTest method changeRequest_sot.
@Test
public void changeRequest_sot() throws Exception {
origin.addSimpleChange(0, "Base Change").addSimpleChange(1, "First Change").addSimpleChange(2, "Second Change").addSimpleChange(3, "Third Change");
Workflow<?, ?> workflow = iterativeWorkflow("0");
workflow.run(workdir, ImmutableList.of("HEAD"));
ProcessedChange change = destination.processed.get(2);
assertThat(change.getBaseline()).isNull();
assertThat(change.getChangesSummary()).isEqualTo("Third Change");
Workflow<?, ?> w = skylarkWorkflow("default", WorkflowMode.CHANGE_REQUEST_FROM_SOT);
w.run(workdir, ImmutableList.of("2"));
change = destination.processed.get(destination.processed.size() - 1);
assertThat(change.getChangesSummary()).isEqualTo("Second Change");
assertThat(change.getBaseline()).isEqualTo("1");
}
Aggregations