Skip to content

Commit

Permalink
Fix failing testGetPrimaryTermAndGeneration in TranslogTransferManage…
Browse files Browse the repository at this point in the history
…rTests (#10490)

Signed-off-by: Ashish Singh <[email protected]>
  • Loading branch information
ashking94 authored Oct 7, 2023
1 parent 732ce21 commit 22ddcf1
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;

import org.mockito.Mockito;
Expand Down Expand Up @@ -504,8 +506,12 @@ private void assertTlogCkpDownloadStats() {
}

public void testGetPrimaryTermAndGeneration() {
String tm = new TranslogTransferMetadata(1, 2, 1, 2, "node-1").getFileName();
assertEquals(new Tuple<>(new Tuple<>(1L, 2L), "node-1"), TranslogTransferMetadata.getNodeIdByPrimaryTermAndGeneration(tm));
String nodeId = UUID.randomUUID().toString();
String tm = new TranslogTransferMetadata(1, 2, 1, 2, nodeId).getFileName();
Tuple<Tuple<Long, Long>, String> actualOutput = TranslogTransferMetadata.getNodeIdByPrimaryTermAndGeneration(tm);
assertEquals(1L, (long) (actualOutput.v1().v1()));
assertEquals(2L, (long) (actualOutput.v1().v2()));
assertEquals(String.valueOf(Objects.hash(nodeId)), actualOutput.v2());
}

public void testMetadataConflict() throws InterruptedException {
Expand Down

0 comments on commit 22ddcf1

Please sign in to comment.