Skip to content

Commit

Permalink
add test for DiscoveryExtension dependencies field
Browse files Browse the repository at this point in the history
Signed-off-by: Frank Lou <mloufra@amazon.com>
  • Loading branch information
mloufra committed Dec 8, 2022
1 parent 533e653 commit 3818817
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ public void testExtensionsDiscovery() throws Exception {

List<DiscoveryExtension> expectedExtensionsList = new ArrayList<DiscoveryExtension>();

String expectedUniqueId = "uniqueid0";
Version expectedVersion = Version.fromString("2.0.0");
List<ExtensionDependency> dependency = List.of(new ExtensionDependency(expectedUniqueId, expectedVersion));

expectedExtensionsList.add(
new DiscoveryExtension(
"firstExtension",
Expand Down Expand Up @@ -269,6 +273,7 @@ public void testExtensionsDiscovery() throws Exception {
assertEquals(expectedExtensionsList.size(), extensionsOrchestrator.extensionIdMap.values().size());
assertTrue(expectedExtensionsList.containsAll(extensionsOrchestrator.extensionIdMap.values()));
assertTrue(extensionsOrchestrator.extensionIdMap.values().containsAll(expectedExtensionsList));
assertEquals(expectedExtensionsList.get(expectedExtensionsList.size() - 1), dependency.get(0));
}

public void testNonUniqueExtensionsDiscovery() throws Exception {
Expand Down Expand Up @@ -309,6 +314,7 @@ public void testNonUniqueExtensionsDiscovery() throws Exception {
assertEquals(expectedExtensionsList.size(), extensionsOrchestrator.extensionIdMap.values().size());
assertTrue(expectedExtensionsList.containsAll(extensionsOrchestrator.extensionIdMap.values()));
assertTrue(extensionsOrchestrator.extensionIdMap.values().containsAll(expectedExtensionsList));
assertEquals(expectedExtensionsList.get(expectedExtensionsList.size() - 1), emptyList());
}

public void testExtensionDependency() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.opensearch.common.util.PageCacheRecycler;
import org.opensearch.extensions.DiscoveryExtension;
import org.opensearch.extensions.ExtensionBooleanResponse;
import org.opensearch.extensions.ExtensionDependency;
import org.opensearch.extensions.RegisterTransportActionsRequest;
import org.opensearch.extensions.rest.RestSendToExtensionActionTests;
import org.opensearch.indices.breaker.NoneCircuitBreakerService;
Expand All @@ -40,7 +39,6 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.opensearch.common.transport.TransportAddress;
import org.opensearch.common.util.PageCacheRecycler;
import org.opensearch.extensions.DiscoveryExtension;
import org.opensearch.extensions.ExtensionDependency;
import org.opensearch.indices.breaker.NoneCircuitBreakerService;
import org.opensearch.plugins.PluginInfo;
import org.opensearch.rest.RestHandler.Route;
Expand Down

0 comments on commit 3818817

Please sign in to comment.