Skip to content

Commit 614a350

Browse files
committed
Simplify test assertions
1 parent a477ff4 commit 614a350

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

server/src/test/java/org/elasticsearch/index/seqno/ReplicationTrackerTests.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,8 @@ private static Set<String> ids(Set<AllocationId> allocationIds) {
102102
}
103103

104104
private void updateLocalCheckpoint(final ReplicationTracker tracker, final String allocationId, final long localCheckpoint) {
105-
final long globalCheckpoint = tracker.getGlobalCheckpoint();
106-
updatedGlobalCheckpoint.set(globalCheckpoint);
107105
tracker.updateLocalCheckpoint(allocationId, localCheckpoint);
108-
if (globalCheckpoint == tracker.getGlobalCheckpoint()) {
109-
assertThat(updatedGlobalCheckpoint.get(), equalTo(globalCheckpoint));
110-
} else {
111-
assertThat(updatedGlobalCheckpoint.get(), equalTo(tracker.getGlobalCheckpoint()));
112-
}
106+
assertThat(updatedGlobalCheckpoint.get(), equalTo(tracker.getGlobalCheckpoint()));
113107
}
114108

115109
public void testGlobalCheckpointUpdate() {
@@ -433,7 +427,7 @@ public void testWaitForAllocationIdToBeInSync() throws Exception {
433427
thread.join();
434428
}
435429

436-
private AtomicLong updatedGlobalCheckpoint = new AtomicLong();
430+
private AtomicLong updatedGlobalCheckpoint = new AtomicLong(UNASSIGNED_SEQ_NO);
437431

438432
private ReplicationTracker newTracker(final AllocationId allocationId) {
439433
return new ReplicationTracker(

0 commit comments

Comments
 (0)