Skip to content

Commit

Permalink
add comment explaining the UTs
Browse files Browse the repository at this point in the history
Signed-off-by: bansvaru <[email protected]>
  • Loading branch information
linuxpi committed Oct 20, 2023
1 parent 4df543c commit 0592116
Showing 1 changed file with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1128,17 +1128,15 @@ private void mockObjectsForGettingPreviousClusterUUID(Map<String, String> cluste
mockBlobContainerForGlobalMetadata(blobContainer2, clusterManifest2, metadata2);
mockBlobContainer(blobContainer2, clusterManifest2, indexMetadataMap2, ClusterMetadataManifest.CODEC_V1);

// controls whether we should differ index metadata or global metadata when comparing uuid1 and uuid3
// differGlobalMetadata controls which one of IndexMetadata or Metadata object would be different
// when comparing cluster-uuid3 and cluster-uuid1 state.
// if set true, only Metadata will differ b/w cluster uuid1 and cluster uuid3.
// If set to false, only IndexMetadata would be different
// Adding difference in EXACTLY on of these randomly will help us test if our uuid trimming logic compares both
// IndexMetadata and Metadata when deciding if the remote state b/w two different cluster uuids is same.
List<UploadedIndexMetadata> uploadedIndexMetadataList3 = differGlobalMetadata
? new ArrayList<>(uploadedIndexMetadataList1)
: List.of(new UploadedIndexMetadata("index1", "index-uuid1", "key1"));
final ClusterMetadataManifest clusterManifest3 = generateClusterMetadataManifest(
"cluster-uuid3",
clusterUUIDsPointers.get("cluster-uuid3"),
randomAlphaOfLength(10),
uploadedIndexMetadataList3,
"test-metadata3"
);
IndexMetadata indexMetadata5 = IndexMetadata.builder("index1")
.settings(indexSettings)
.numberOfShards(1)
Expand All @@ -1150,6 +1148,14 @@ private void mockObjectsForGettingPreviousClusterUUID(Map<String, String> cluste
Metadata metadata3 = Metadata.builder()
.persistentSettings(Settings.builder().put(Metadata.SETTING_READ_ONLY_SETTING.getKey(), !differGlobalMetadata).build())
.build();

final ClusterMetadataManifest clusterManifest3 = generateClusterMetadataManifest(
"cluster-uuid3",
clusterUUIDsPointers.get("cluster-uuid3"),
randomAlphaOfLength(10),
uploadedIndexMetadataList3,
"test-metadata3"
);
mockBlobContainerForGlobalMetadata(blobContainer3, clusterManifest3, metadata3);
mockBlobContainer(blobContainer3, clusterManifest3, indexMetadataMap3, ClusterMetadataManifest.CODEC_V1);

Expand Down

0 comments on commit 0592116

Please sign in to comment.