Skip to content

Commit

Permalink
Revert change to SlowIntegrationTests
Browse files Browse the repository at this point in the history
Signed-off-by: Craig Perkins <[email protected]>
  • Loading branch information
cwperks committed Nov 3, 2023
1 parent ccb73f0 commit 66e0f02
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions src/test/java/org/opensearch/security/SlowIntegrationTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

package org.opensearch.security;

import java.io.IOException;

import com.google.common.collect.Lists;
import org.apache.hc.core5.http.HttpStatus;
import org.junit.Assert;
Expand Down Expand Up @@ -221,24 +223,24 @@ public void testDelayInSecurityIndexInitialization() throws Exception {
.put(ConfigConstants.SECURITY_ALLOW_DEFAULT_INIT_SECURITYINDEX, true)
.put("cluster.routing.allocation.exclude._ip", "127.0.0.1")
.build();
setup(Settings.EMPTY, null, settings, false);
Thread.sleep(1000 * 30);
Assert.assertEquals(
ClusterHealthStatus.RED,
clusterHelper.nodeClient().admin().cluster().health(new ClusterHealthRequest()).actionGet().getStatus()
);
Thread.sleep(1000 * 30);
// Ideally, we would want to remove this cluster setting, but default settings cannot be removed. So overriding with a reserved
// IP address
clusterHelper.nodeClient()
.admin()
.cluster()
.updateSettings(
new ClusterUpdateSettingsRequest().transientSettings(
Settings.builder().put("cluster.routing.allocation.exclude._ip", "192.0.2.0").build()
)
);
this.clusterInfo = clusterHelper.waitForCluster(ClusterHealthStatus.GREEN, TimeValue.timeValueSeconds(10), 3);
try {
setup(Settings.EMPTY, null, settings, false);
Assert.fail("Expected IOException here due to red cluster state");
} catch (IOException e) {
// Index request has a default timeout of 1 minute, adding buffer between nodes initialization and cluster health check
Thread.sleep(1000 * 80);
// Ideally, we would want to remove this cluster setting, but default settings cannot be removed. So overriding with a reserved
// IP address
clusterHelper.nodeClient()
.admin()
.cluster()
.updateSettings(
new ClusterUpdateSettingsRequest().transientSettings(
Settings.builder().put("cluster.routing.allocation.exclude._ip", "192.0.2.0").build()
)
);
this.clusterInfo = clusterHelper.waitForCluster(ClusterHealthStatus.GREEN, TimeValue.timeValueSeconds(10), 3);
}
RestHelper rh = nonSslRestHelper();
Thread.sleep(10000);
Assert.assertEquals(HttpStatus.SC_OK, rh.executeGetRequest("", encodeBasicHeader("admin", "admin")).getStatusCode());
Expand Down

0 comments on commit 66e0f02

Please sign in to comment.