forked from opensearch-project/security
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cd1dcbd
commit ddc238f
Showing
7 changed files
with
152 additions
and
77 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
src/integrationTest/java/org/opensearch/security/NoSslClusterTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package org.opensearch.security; | ||
|
||
import java.util.Map; | ||
|
||
import com.carrotsearch.randomizedtesting.RandomizedRunner; | ||
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope; | ||
import org.apache.commons.lang3.RandomStringUtils; | ||
import org.awaitility.Awaitility; | ||
import org.junit.ClassRule; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import org.opensearch.test.framework.TestSecurityConfig; | ||
import org.opensearch.test.framework.cluster.ClusterManager; | ||
import org.opensearch.test.framework.cluster.LocalCluster; | ||
import org.opensearch.test.framework.cluster.TestRestClient; | ||
|
||
import static org.hamcrest.Matchers.equalTo; | ||
import static org.opensearch.security.ssl.util.SSLConfigConstants.SECURITY_SSL_HTTP_ENABLED; | ||
import static org.opensearch.security.ssl.util.SSLConfigConstants.SECURITY_SSL_TRANSPORT_ENABLED; | ||
import static org.opensearch.security.support.ConfigConstants.SECURITY_BACKGROUND_INIT_IF_SECURITYINDEX_NOT_EXIST; | ||
import static org.opensearch.test.framework.TestSecurityConfig.AuthcDomain.AUTHC_HTTPBASIC_INTERNAL; | ||
import static org.opensearch.test.framework.TestSecurityConfig.Role.ALL_ACCESS; | ||
|
||
@RunWith(RandomizedRunner.class) | ||
@ThreadLeakScope(ThreadLeakScope.Scope.NONE) | ||
public class NoSslClusterTests { | ||
|
||
public static final String ADMIN_PASSWORD = RandomStringUtils.randomAlphabetic(10); | ||
|
||
private static final TestSecurityConfig.User USER_ADMIN = new TestSecurityConfig.User("admin").password(ADMIN_PASSWORD) | ||
.roles(ALL_ACCESS); | ||
|
||
@ClassRule | ||
public static LocalCluster cluster = new LocalCluster.Builder().clusterManager(ClusterManager.THREE_CLUSTER_MANAGERS) | ||
.authc(AUTHC_HTTPBASIC_INTERNAL) | ||
.users(USER_ADMIN) | ||
.anonymousAuth(false) | ||
.nodeSettings( | ||
Map.of( | ||
SECURITY_BACKGROUND_INIT_IF_SECURITYINDEX_NOT_EXIST, | ||
false, | ||
SECURITY_SSL_HTTP_ENABLED, | ||
false, | ||
SECURITY_SSL_TRANSPORT_ENABLED, | ||
false | ||
) | ||
) | ||
.build(); | ||
|
||
@Test | ||
public void testNoSslBootUp() throws Exception { | ||
try (TestRestClient client = cluster.getRestClient(USER_ADMIN.getName(), ADMIN_PASSWORD)) { | ||
Awaitility.await() | ||
.alias("Load default configuration") | ||
.until(() -> client.securityHealth().getTextFromJsonBody("/status"), equalTo("UP")); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.