-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing IndexRoutingTableInputStream and moving checksum to end to file
Signed-off-by: Himshikha Gupta <himshikh@amazon.com>
- Loading branch information
Himshikha Gupta
committed
May 7, 2024
1 parent
f65b102
commit 441f520
Showing
4 changed files
with
86 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...rc/test/java/org/opensearch/gateway/remote/routingtable/IndexRoutingTableHeaderTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.gateway.remote.routingtable; | ||
|
||
import org.apache.lucene.codecs.CodecUtil; | ||
import org.apache.lucene.store.InputStreamDataInput; | ||
import org.opensearch.Version; | ||
import org.opensearch.common.io.stream.BytesStreamOutput; | ||
import org.opensearch.core.common.io.stream.BytesStreamInput; | ||
import org.opensearch.core.common.io.stream.StreamOutput; | ||
import org.opensearch.test.OpenSearchTestCase; | ||
|
||
import java.io.IOException; | ||
|
||
public class IndexRoutingTableHeaderTests extends OpenSearchTestCase { | ||
|
||
public void testWrite() throws IOException { | ||
BytesStreamOutput out = new BytesStreamOutput(); | ||
IndexRoutingTableHeader header = new IndexRoutingTableHeader(1, "dummyIndex", Version.V_3_0_0); | ||
header.write(out); | ||
|
||
BytesStreamInput in = new BytesStreamInput(out.bytes().toBytesRef().bytes); | ||
CodecUtil.checkHeader(new InputStreamDataInput(in),IndexRoutingTableHeader.INDEX_ROUTING_HEADER_CODEC, IndexRoutingTableHeader.INITIAL_VERSION, IndexRoutingTableHeader.CURRENT_VERSION ); | ||
assertEquals(1, in.readLong()); | ||
assertEquals(Version.V_3_0_0.id, in.readInt()); | ||
assertEquals("dummyIndex", in.readString()); | ||
} | ||
|
||
} |