Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Arpit Bandejiya <[email protected]>
  • Loading branch information
Arpit-Bandejiya committed Jul 10, 2024
1 parent 1a5df72 commit 7b8a443
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public BlobPath getBlobPathForUpload(final AbstractRemoteWritableBlobEntity<Inde
.add("cluster-state")
.add(obj.clusterUUID())
.add(INDEX_ROUTING_TABLE);

BlobPath path = pathType.path(
RemoteStorePathStrategy.PathInput.builder()
.basePath(indexRoutingPath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,13 @@ public RemoteIndexRoutingTable(String blobName, String clusterUUID, Compressor c
this.blobName = blobName;
}

public IndexRoutingTable getIndexRoutingTable() {
return indexRoutingTable;
}

public Index getIndex() {
return index;
}

@Override
public BlobPathParameters getBlobPathParameters() {
return new BlobPathParameters(List.of(indexRoutingTable.getIndex().getUUID()));
return new BlobPathParameters(List.of(indexRoutingTable.getIndex().getUUID()), INDEX_ROUTING_FILE);
}

@Override
Expand All @@ -91,7 +87,7 @@ public String generateBlobFileName() {
if (blobFileName == null) {
blobFileName = String.join(
DELIMITER,
INDEX_ROUTING_FILE,
getBlobPathParameters().getFilePrefix(),
RemoteStoreUtils.invertLong(term),
RemoteStoreUtils.invertLong(version),
RemoteStoreUtils.invertLong(System.currentTimeMillis())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
import static org.opensearch.gateway.remote.ClusterMetadataManifestTests.randomUploadedIndexMetadataList;
import static org.opensearch.gateway.remote.RemoteClusterStateUtils.DELIMITER;
import static org.opensearch.gateway.remote.RemoteClusterStateUtils.PATH_DELIMITER;
import static org.opensearch.gateway.remote.routingtable.RemoteIndexRoutingTable.INDEX_ROUTING_FILE;
import static org.opensearch.gateway.remote.routingtable.RemoteIndexRoutingTable.INDEX_ROUTING_METADATA_PREFIX;
import static org.opensearch.gateway.remote.routingtable.RemoteIndexRoutingTable.INDEX_ROUTING_TABLE;
import static org.opensearch.gateway.remote.routingtable.RemoteIndexRoutingTable.INDEX_ROUTING_TABLE_FORMAT;
import static org.opensearch.gateway.remote.routingtable.RemoteIndexRoutingTable.INDEX_ROUTING_TABLE_PREFIX;
Expand Down Expand Up @@ -577,7 +579,7 @@ public void testGetAsyncIndexRoutingWriteAction() throws Exception {
assertNotNull(listener.getResult());
ClusterMetadataManifest.UploadedMetadata uploadedMetadata = listener.getResult();

assertEquals(INDEX_ROUTING_TABLE_PREFIX + indexName, uploadedMetadata.getComponent());
assertEquals(INDEX_ROUTING_METADATA_PREFIX + indexName, uploadedMetadata.getComponent());
String uploadedFileName = uploadedMetadata.getUploadedFilename();
String[] pathTokens = uploadedFileName.split(PATH_DELIMITER);
assertEquals(8, pathTokens.length);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
import static org.opensearch.gateway.remote.model.RemotePersistentSettingsMetadata.SETTING_METADATA;
import static org.opensearch.gateway.remote.model.RemoteTemplatesMetadata.TEMPLATES_METADATA;
import static org.opensearch.gateway.remote.model.RemoteTemplatesMetadata.TEMPLATES_METADATA_FORMAT;
import static org.opensearch.gateway.remote.routingtable.RemoteIndexRoutingTable.INDEX_ROUTING_METADATA_PREFIX;
import static org.opensearch.gateway.remote.routingtable.RemoteIndexRoutingTable.INDEX_ROUTING_TABLE;
import static org.opensearch.gateway.remote.model.RemoteTemplatesMetadataTests.getTemplatesMetadata;
import static org.opensearch.gateway.remote.model.RemoteTransientSettingsMetadata.TRANSIENT_SETTING_METADATA;
Expand Down Expand Up @@ -2605,7 +2606,7 @@ public void testWriteFullMetadataSuccessWithRoutingTable() throws IOException {
"test-index",
"index-uuid",
"routing-filename",
INDEX_ROUTING_TABLE + CUSTOM_DELIMITER
INDEX_ROUTING_METADATA_PREFIX
);
final ClusterMetadataManifest expectedManifest = ClusterMetadataManifest.builder()
.indices(List.of(uploadedIndexMetadata))
Expand Down Expand Up @@ -2656,7 +2657,7 @@ public void testWriteFullMetadataInParallelSuccessWithRoutingTable() throws IOEx
"test-index",
"index-uuid",
"routing-filename",
INDEX_ROUTING_TABLE + CUSTOM_DELIMITER
INDEX_ROUTING_METADATA_PREFIX
);

final ClusterMetadataManifest expectedManifest = ClusterMetadataManifest.builder()
Expand Down Expand Up @@ -2711,7 +2712,7 @@ public void testWriteIncrementalMetadataSuccessWithRoutingTable() throws IOExcep
"test-index",
"index-uuid",
"routing-filename",
INDEX_ROUTING_TABLE + CUSTOM_DELIMITER
INDEX_ROUTING_METADATA_PREFIX
);
final ClusterMetadataManifest expectedManifest = ClusterMetadataManifest.builder()
.indices(List.of(uploadedIndexMetadata))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public void testGetUploadedMetadata() throws IOException {
try (InputStream inputStream = remoteObjectForUpload.serialize()) {
remoteObjectForUpload.setFullBlobName(new BlobPath().add(TEST_BLOB_PATH));
ClusterMetadataManifest.UploadedMetadata uploadedMetadata = remoteObjectForUpload.getUploadedMetadata();
String expectedPrefix = String.join(CUSTOM_DELIMITER, INDEX_ROUTING_TABLE, indexRoutingTable.getIndex().getName());
String expectedPrefix = INDEX_ROUTING_TABLE_PREFIX + indexRoutingTable.getIndex().getName();
assertThat(uploadedMetadata.getComponent(), is(expectedPrefix));
assertThat(uploadedMetadata.getUploadedFilename(), is(remoteObjectForUpload.getFullBlobName()));
} catch (IOException e) {
Expand Down

0 comments on commit 7b8a443

Please sign in to comment.