use of com.google.copybara.testing.profiler.RecordingListener in project copybara by google.
the class ProfilerTest method setUp.
@Before
public void setUp() throws Exception {
ticker = new FakeTicker().setAutoIncrementStep(1, TimeUnit.NANOSECONDS);
profiler = new Profiler(ticker);
recordingCallback = new RecordingListener();
// We don't record anything before start
try (ProfilerTask ignore = profiler.start("bar")) {
profiler.simpleTask("foo", 10, 20);
}
assertThat(recordingCallback.events).isEmpty();
profiler.init(ImmutableList.of(recordingCallback));
}
use of com.google.copybara.testing.profiler.RecordingListener in project copybara by google.
the class GitMirrorTest method testMirror.
@Test
public void testMirror() throws Exception {
RecordingListener recordingCallback = new RecordingListener();
Profiler profiler = new Profiler(new FakeTicker());
profiler.init(ImmutableList.of(recordingCallback));
options.general.withProfiler(profiler);
Migration mirror = createMirrorObj();
mirror.run(workdir, ImmutableList.of());
String orig = originRepo.git(originRepo.getGitDir(), "show-ref").getStdout();
String dest = destRepo.git(destRepo.getGitDir(), "show-ref").getStdout();
assertThat(dest).isEqualTo(orig);
recordingCallback.assertMatchesNext(EventType.START, "//copybara").assertMatchesNext(EventType.START, "//copybara/run/default").assertMatchesNext(EventType.START, "//copybara/run/default/fetch").assertMatchesNext(EventType.END, "//copybara/run/default/fetch").assertMatchesNext(EventType.START, "//copybara/run/default/push").assertMatchesNext(EventType.END, "//copybara/run/default/push").assertMatchesNext(EventType.END, "//copybara/run/default");
}
Aggregations