Skip to content

Commit

Permalink
Changing unit tests for targetservice class.
Browse files Browse the repository at this point in the history
Signed-off-by: Rishikesh1159 <[email protected]>
  • Loading branch information
Rishikesh1159 committed Jun 16, 2022
1 parent 7cdd4fa commit efb1f8f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,7 @@ public void onReplicationDone(SegmentReplicationState state) {
// if we received a checkpoint during the copy event that is ahead of this
// try and process it.
if (getLatestReceivedCheckpoint(indexShard.shardId()).isAheadOf(indexShard.getLatestReplicationCheckpoint())) {
threadPool.generic()
.execute(
() -> onNewCheckpoint(
getLatestReceivedCheckpoint(indexShard.shardId()),
indexShard
)
);
onNewCheckpoint(getLatestReceivedCheckpoint(indexShard.shardId()), indexShard);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,14 @@ public void testReplicationOnDone() throws IOException {
);
spy.onNewCheckpoint(newCheckpoint, spyShard);
spy.onNewCheckpoint(newCheckpoint2, spyShard);
verify(spy, times(1)).onNewCheckpoint(eq(newCheckpoint2), any());
ArgumentCaptor<SegmentReplicationTargetService.SegmentReplicationListener> captor = ArgumentCaptor.forClass(
SegmentReplicationTargetService.SegmentReplicationListener.class
);
verify(spy, times(1)).startReplication(any(), any(), captor.capture());
verify(spy, times(1)).startReplication(eq(newCheckpoint), any(), captor.capture());
SegmentReplicationTargetService.SegmentReplicationListener listener = captor.getValue();
listener.onDone(new SegmentReplicationState());
verify(spy, times(1)).startReplication(any(), any(), any());
verify(spy, times(2)).onNewCheckpoint(eq(newCheckpoint2), any());
closeShard(indexShard, false);

}
Expand Down

0 comments on commit efb1f8f

Please sign in to comment.