Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void getAsyncIndexRoutingWriteAction(
IndexRoutingTable indexRouting,
LatchedActionListener<ClusterMetadataManifest.UploadedMetadata> latchedActionListener
) {
// noop
latchedActionListener.onResponse(null);
}

@Override
Expand All @@ -54,7 +54,7 @@ public void getAsyncIndexRoutingDiffWriteAction(
StringKeyDiffProvider<IndexRoutingTable> routingTableDiff,
LatchedActionListener<ClusterMetadataManifest.UploadedMetadata> latchedActionListener
) {
// noop
latchedActionListener.onResponse(null);
}

@Override
Expand All @@ -73,7 +73,7 @@ public void getAsyncIndexRoutingReadAction(
String uploadedFilename,
LatchedActionListener<IndexRoutingTable> latchedActionListener
) {
// noop
latchedActionListener.onResponse(null);
}

@Override
Expand All @@ -82,7 +82,7 @@ public void getAsyncIndexRoutingTableDiffReadAction(
String uploadedFilename,
LatchedActionListener<Diff<RoutingTable>> latchedActionListener
) {
// noop
latchedActionListener.onResponse(null);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* 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.cluster.routing.remote;

import org.opensearch.action.LatchedActionListener;
import org.opensearch.cluster.Diff;
import org.opensearch.cluster.routing.IndexRoutingTable;
import org.opensearch.cluster.routing.RoutingTable;
import org.opensearch.common.util.TestCapturingListener;
import org.opensearch.gateway.remote.ClusterMetadataManifest;
import org.opensearch.test.OpenSearchTestCase;
import org.junit.Before;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

public class NoopRemoteRoutingTableServiceTests extends OpenSearchTestCase {
private NoopRemoteRoutingTableService service;

@Before
public void setup() {
service = new NoopRemoteRoutingTableService();
}

public void testGetAsyncIndexRoutingWriteAction() throws InterruptedException {
CountDownLatch latch = new CountDownLatch(1);
TestCapturingListener<ClusterMetadataManifest.UploadedMetadata> capturingListener = new TestCapturingListener<>();
LatchedActionListener<ClusterMetadataManifest.UploadedMetadata> listener = new LatchedActionListener<>(capturingListener, latch);
service.getAsyncIndexRoutingWriteAction("clusterUUID", 1, 1, null, listener);
latch.await(100, TimeUnit.MILLISECONDS);
assertNull(capturingListener.getResult());
}

public void testGetAsyncIndexRoutingReadAction() throws InterruptedException {
CountDownLatch latch = new CountDownLatch(1);
TestCapturingListener<IndexRoutingTable> capturingListener = new TestCapturingListener<>();
LatchedActionListener<IndexRoutingTable> listener = new LatchedActionListener<>(capturingListener, latch);
service.getAsyncIndexRoutingReadAction("clusterUUID", "filename", listener);
latch.await(100, TimeUnit.MILLISECONDS);
assertNull(capturingListener.getResult());
}

public void testGetAsyncIndexRoutingDiffWriteAction() throws InterruptedException {
CountDownLatch latch = new CountDownLatch(1);
TestCapturingListener<ClusterMetadataManifest.UploadedMetadata> capturingListener = new TestCapturingListener<>();
LatchedActionListener<ClusterMetadataManifest.UploadedMetadata> listener = new LatchedActionListener<>(capturingListener, latch);
service.getAsyncIndexRoutingDiffWriteAction("clusterUUID", 1, 1, null, listener);
latch.await(100, TimeUnit.MILLISECONDS);
assertNull(capturingListener.getResult());
}

public void testGetAsyncIndexRoutingDiffReadAction() throws InterruptedException {
CountDownLatch latch = new CountDownLatch(1);
TestCapturingListener<Diff<RoutingTable>> capturingListener = new TestCapturingListener<>();
LatchedActionListener<Diff<RoutingTable>> listener = new LatchedActionListener<>(capturingListener, latch);
service.getAsyncIndexRoutingTableDiffReadAction("clusterUUID", "filename", listener);
latch.await(100, TimeUnit.MILLISECONDS);
assertNull(capturingListener.getResult());
}
}
Loading