diff --git a/server/src/test/java/org/opensearch/gateway/remote/ClusterMetadataManifestTests.java b/server/src/test/java/org/opensearch/gateway/remote/ClusterMetadataManifestTests.java index d1d9137c36853..21876acdffe38 100644 --- a/server/src/test/java/org/opensearch/gateway/remote/ClusterMetadataManifestTests.java +++ b/server/src/test/java/org/opensearch/gateway/remote/ClusterMetadataManifestTests.java @@ -36,7 +36,7 @@ public void testClusterMetadataManifestXContent() throws IOException { Version.CURRENT, "test-node-id", false, - 1, + ClusterMetadataManifest.CODEC_V0, null, Collections.singletonList(uploadedIndexMetadata), "prev-cluster-uuid", @@ -53,7 +53,7 @@ public void testClusterMetadataManifestXContent() throws IOException { } } - public void testClusterMetadataManifestXContentCodecV2() throws IOException { + public void testClusterMetadataManifestXContentCodecV1() throws IOException { UploadedIndexMetadata uploadedIndexMetadata = new UploadedIndexMetadata("test-index", "test-uuid", "/test/upload/path"); ClusterMetadataManifest originalManifest = new ClusterMetadataManifest( 1L, @@ -63,7 +63,7 @@ public void testClusterMetadataManifestXContentCodecV2() throws IOException { Version.CURRENT, "test-node-id", false, - 2, + ClusterMetadataManifest.CODEC_V1, "test-global-metadata-file", Collections.singletonList(uploadedIndexMetadata), "prev-cluster-uuid", @@ -75,7 +75,7 @@ public void testClusterMetadataManifestXContentCodecV2() throws IOException { builder.endObject(); try (XContentParser parser = createParser(JsonXContent.jsonXContent, BytesReference.bytes(builder))) { - final ClusterMetadataManifest fromXContentManifest = ClusterMetadataManifest.fromXContentV2(parser); + final ClusterMetadataManifest fromXContentManifest = ClusterMetadataManifest.fromXContentV1(parser); assertEquals(originalManifest, fromXContentManifest); } } diff --git a/server/src/test/java/org/opensearch/gateway/remote/RemoteClusterStateServiceTests.java b/server/src/test/java/org/opensearch/gateway/remote/RemoteClusterStateServiceTests.java index b5f72d204d361..57ea73ba9619c 100644 --- a/server/src/test/java/org/opensearch/gateway/remote/RemoteClusterStateServiceTests.java +++ b/server/src/test/java/org/opensearch/gateway/remote/RemoteClusterStateServiceTests.java @@ -386,9 +386,9 @@ public void testMigrationFromCodecV0ManifestToCodecV1Manifest() throws IOExcepti Metadata newMetadata = Metadata.builder(previousClusterState.metadata()).put(indexMetadata, true).build(); ClusterState newClusterState = ClusterState.builder(previousClusterState).metadata(newMetadata).build(); - // previous manifest with codec 1 and null global metadata + // previous manifest with codec 0 and null global metadata final ClusterMetadataManifest previousManifest = ClusterMetadataManifest.builder() - .codecVersion(1) + .codecVersion(ClusterMetadataManifest.CODEC_V0) .globalMetadataFileName(null) .indices(Collections.emptyList()) .build(); @@ -402,8 +402,8 @@ public void testMigrationFromCodecV0ManifestToCodecV1Manifest() throws IOExcepti // global metadata is updated assertThat(manifestAfterUpdate.getGlobalMetadataFileName(), notNullValue()); - // Manifest file with codec version with 2 is updated. - assertThat(manifestAfterUpdate.getCodecVersion(), is(2)); + // Manifest file with codec version with 1 is updated. + assertThat(manifestAfterUpdate.getCodecVersion(), is(ClusterMetadataManifest.CODEC_V1)); } public void testWriteIncrementalGlobalMetadataSuccess() throws IOException { @@ -626,8 +626,7 @@ public void testReadLatestMetadataManifestSuccessButNoIndexMetadata() throws IOE .nodeId("nodeA") .opensearchVersion(VersionUtils.randomOpenSearchVersion(random())) .previousClusterUUID("prev-cluster-uuid") - .globalMetadataFileName("global-metadata-file") - .codecVersion(1) + .codecVersion(ClusterMetadataManifest.CODEC_V0) .build(); BlobContainer blobContainer = mockBlobStoreObjects(); @@ -684,8 +683,7 @@ public void testReadLatestMetadataManifestSuccess() throws IOException { .clusterUUID("cluster-uuid") .nodeId("nodeA") .opensearchVersion(VersionUtils.randomOpenSearchVersion(random())) - .globalMetadataFileName("global-metadata") - .codecVersion(1) + .codecVersion(ClusterMetadataManifest.CODEC_V0) .previousClusterUUID("prev-cluster-uuid") .build(); @@ -732,8 +730,7 @@ public void testReadLatestIndexMetadataSuccess() throws IOException { .nodeId("nodeA") .opensearchVersion(VersionUtils.randomOpenSearchVersion(random())) .previousClusterUUID("prev-cluster-uuid") - .globalMetadataFileName("global-metadata") - .codecVersion(1) + .codecVersion(ClusterMetadataManifest.CODEC_V0) .build(); mockBlobContainer(mockBlobStoreObjects(), expectedManifest, Map.of(index.getUUID(), indexMetadata));