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 86133be86ff36..65c369b9b11b8 100644 --- a/server/src/test/java/org/opensearch/gateway/remote/RemoteClusterStateServiceTests.java +++ b/server/src/test/java/org/opensearch/gateway/remote/RemoteClusterStateServiceTests.java @@ -80,19 +80,15 @@ public void testFailWriteFullMetadataNonClusterManagerNode() throws IOException Assert.assertThat(manifest, nullValue()); } - public void testFailWriteFullMetadataWhenRemoteStateDisabled() throws IOException { + public void testFailInitializationWhenRemoteStateDisabled() throws IOException { final Settings settings = Settings.builder().build(); - remoteClusterStateService = spy( - new RemoteClusterStateService( - "test-node-id", - repositoriesServiceSupplier, - settings, - new ClusterSettings(settings, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS), - () -> 0L - ) - ); - final ClusterState clusterState = generateClusterStateWithOneIndex().nodes(nodesWithLocalNodeClusterManager()).build(); - assertThrows(AssertionError.class, () -> remoteClusterStateService.writeFullMetadata(clusterState)); + assertThrows(AssertionError.class, () -> new RemoteClusterStateService( + "test-node-id", + repositoriesServiceSupplier, + settings, + new ClusterSettings(settings, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS), + () -> 0L + )); } public void testFailWriteFullMetadataWhenRepositoryNotSet() {