From 9fdb73ae4fa6b3e188bf0688f8ce76d935aa6fe3 Mon Sep 17 00:00:00 2001 From: Lukasz Soszynski Date: Mon, 19 Sep 2022 11:16:43 +0200 Subject: [PATCH] Correction after code review, removed some comments and one javadoc added. Signed-off-by: Lukasz Soszynski --- .../opensearch/test/framework/cluster/ClusterManager.java | 2 -- .../framework/cluster/ContextHeaderDecoratorClient.java | 3 +++ .../cluster/MinimumSecuritySettingsSupplierFactory.java | 4 +--- .../org/opensearch/test/framework/cluster/SocketUtils.java | 7 ------- .../test/framework/cluster/SocketUtilsTests.java | 4 ++-- 5 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/integrationTest/java/org/opensearch/test/framework/cluster/ClusterManager.java b/src/integrationTest/java/org/opensearch/test/framework/cluster/ClusterManager.java index b135df3620..005321b24c 100644 --- a/src/integrationTest/java/org/opensearch/test/framework/cluster/ClusterManager.java +++ b/src/integrationTest/java/org/opensearch/test/framework/cluster/ClusterManager.java @@ -50,8 +50,6 @@ import static org.opensearch.test.framework.cluster.NodeType.DATA; public enum ClusterManager { - //first one needs to be a cluster manager - //HUGE(new NodeSettings(true, false, false), new NodeSettings(true, false, false), new NodeSettings(true, false, false), new NodeSettings(false, true,false), new NodeSettings(false, true, false)), //3 nodes (1m, 2d) DEFAULT(new NodeSettings(true, false), new NodeSettings(false, true), new NodeSettings(false, true)), diff --git a/src/integrationTest/java/org/opensearch/test/framework/cluster/ContextHeaderDecoratorClient.java b/src/integrationTest/java/org/opensearch/test/framework/cluster/ContextHeaderDecoratorClient.java index f5cd4ffc2f..890de49ed7 100644 --- a/src/integrationTest/java/org/opensearch/test/framework/cluster/ContextHeaderDecoratorClient.java +++ b/src/integrationTest/java/org/opensearch/test/framework/cluster/ContextHeaderDecoratorClient.java @@ -22,6 +22,9 @@ import org.opensearch.common.util.concurrent.ThreadContext; import org.opensearch.common.util.concurrent.ThreadContext.StoredContext; +/** +* The class adds provided headers into context before sending request via wrapped {@link Client} +*/ public class ContextHeaderDecoratorClient extends FilterClient { private Map headers; diff --git a/src/integrationTest/java/org/opensearch/test/framework/cluster/MinimumSecuritySettingsSupplierFactory.java b/src/integrationTest/java/org/opensearch/test/framework/cluster/MinimumSecuritySettingsSupplierFactory.java index 263ec65b1d..37cf69b266 100644 --- a/src/integrationTest/java/org/opensearch/test/framework/cluster/MinimumSecuritySettingsSupplierFactory.java +++ b/src/integrationTest/java/org/opensearch/test/framework/cluster/MinimumSecuritySettingsSupplierFactory.java @@ -54,9 +54,7 @@ public NodeSettingsSupplier minimumOpenSearchSettingsSslOnly(Settings other) { private Settings.Builder minimumOpenSearchSettingsBuilder(int node, boolean sslOnly) { Settings.Builder builder = Settings.builder(); - - // TODO: At the moment the test node certificates have an OID set, so we do not need to - // specify any node_dns here. Once we make generating and specifying + builder.put("plugins.security.ssl.transport.pemtrustedcas_filepath", testCertificates.getRootCertificate().getAbsolutePath()); builder.put("plugins.security.ssl.transport.pemcert_filepath", testCertificates.getNodeCertificate(node).getAbsolutePath()); builder.put("plugins.security.ssl.transport.pemkey_filepath", testCertificates.getNodeKey(node).getAbsolutePath()); diff --git a/src/integrationTest/java/org/opensearch/test/framework/cluster/SocketUtils.java b/src/integrationTest/java/org/opensearch/test/framework/cluster/SocketUtils.java index 273e71026e..92ec47d658 100644 --- a/src/integrationTest/java/org/opensearch/test/framework/cluster/SocketUtils.java +++ b/src/integrationTest/java/org/opensearch/test/framework/cluster/SocketUtils.java @@ -293,13 +293,6 @@ int findAvailablePort(int minPort, int maxPort) { * @throws IllegalStateException if the requested number of available ports could not be found */ SortedSet findAvailablePorts(int numRequested, int minPort, int maxPort) { - //Assert.isTrue(minPort > 0, "'minPort' must be greater than 0"); - //Assert.isTrue(maxPort > minPort, "'maxPort' must be greater than 'minPort'"); - //Assert.isTrue(maxPort <= PORT_RANGE_MAX, "'maxPort' must be less than or equal to " + PORT_RANGE_MAX); - //Assert.isTrue(numRequested > 0, "'numRequested' must be greater than 0"); - //Assert.isTrue((maxPort - minPort) >= numRequested, - // "'numRequested' must not be greater than 'maxPort' - 'minPort'"); - SortedSet availablePorts = new TreeSet<>(); int attemptCount = 0; while ((++attemptCount <= numRequested + 100) && availablePorts.size() < numRequested) { diff --git a/src/integrationTest/java/org/opensearch/test/framework/cluster/SocketUtilsTests.java b/src/integrationTest/java/org/opensearch/test/framework/cluster/SocketUtilsTests.java index d04bfa8024..548bedbfa6 100644 --- a/src/integrationTest/java/org/opensearch/test/framework/cluster/SocketUtilsTests.java +++ b/src/integrationTest/java/org/opensearch/test/framework/cluster/SocketUtilsTests.java @@ -1,5 +1,3 @@ -package org.opensearch.test.framework.cluster; - /* * Copyright 2002-2020 the original author or authors. * @@ -27,6 +25,8 @@ * GitHub history for details. */ +package org.opensearch.test.framework.cluster; + import java.net.DatagramSocket; import java.net.InetAddress; import java.net.ServerSocket;