mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-06 02:49:35 +00:00
Fix rest tests
Original commit: elastic/x-pack-elasticsearch@e92139512b
This commit is contained in:
parent
72fed1be7f
commit
2bb03cba89
@ -6,17 +6,21 @@
|
||||
package org.elasticsearch.watcher.test.rest;
|
||||
|
||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||
import org.elasticsearch.client.support.Headers;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.license.plugin.LicensePlugin;
|
||||
import org.elasticsearch.node.Node;
|
||||
import org.elasticsearch.plugins.PluginsService;
|
||||
import org.elasticsearch.shield.ShieldPlugin;
|
||||
import org.elasticsearch.shield.authc.esusers.ESUsersRealm;
|
||||
import org.elasticsearch.shield.authc.support.Hasher;
|
||||
import org.elasticsearch.shield.authc.support.SecuredString;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.junit.annotations.TestLogging;
|
||||
import org.elasticsearch.test.rest.ElasticsearchRestTestCase;
|
||||
import org.elasticsearch.test.rest.RestTestCandidate;
|
||||
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
||||
import org.elasticsearch.watcher.WatcherPlugin;
|
||||
import org.elasticsearch.watcher.test.AbstractWatcherIntegrationTests;
|
||||
|
||||
@ -39,6 +43,11 @@ public class WatcherRestTests extends ElasticsearchRestTestCase {
|
||||
super(testCandidate);
|
||||
}
|
||||
|
||||
@ParametersFactory
|
||||
public static Iterable<Object[]> parameters() throws IOException, RestTestParseException {
|
||||
return ElasticsearchRestTestCase.createParameters(0, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Settings nodeSettings(int nodeOrdinal) {
|
||||
return Settings.builder()
|
||||
@ -49,6 +58,7 @@ public class WatcherRestTests extends ElasticsearchRestTestCase {
|
||||
+ "," + LicensePlugin.class.getName())
|
||||
.put(Node.HTTP_ENABLED, true)
|
||||
.put(ShieldSettings.settings(shieldEnabled))
|
||||
.put(PluginsService.LOAD_PLUGIN_FROM_CLASSPATH, false)
|
||||
.build();
|
||||
}
|
||||
|
||||
@ -77,6 +87,7 @@ public class WatcherRestTests extends ElasticsearchRestTestCase {
|
||||
+ (shieldEnabled ? ShieldPlugin.class.getName() + "," : ""))
|
||||
.put("shield.user", "admin:changeme")
|
||||
.put(Node.HTTP_ENABLED, true)
|
||||
.put(PluginsService.LOAD_PLUGIN_FROM_CLASSPATH, false)
|
||||
.build();
|
||||
}
|
||||
|
||||
@ -85,6 +96,7 @@ public class WatcherRestTests extends ElasticsearchRestTestCase {
|
||||
.put(Node.HTTP_ENABLED, true)
|
||||
.put("plugin.types", WatcherPlugin.class.getName() + ","
|
||||
+ "," + LicensePlugin.class.getName())
|
||||
.put(PluginsService.LOAD_PLUGIN_FROM_CLASSPATH, false)
|
||||
.build();
|
||||
}
|
||||
|
||||
@ -95,9 +107,12 @@ public class WatcherRestTests extends ElasticsearchRestTestCase {
|
||||
|
||||
public static final String IP_FILTER = "allow: all\n";
|
||||
|
||||
private static final String TEST_PASSWORD = "changeme";
|
||||
private static final String TEST_PASSWORD_HASHED = new String(Hasher.BCRYPT.hash(new SecuredString(TEST_PASSWORD.toCharArray())));
|
||||
|
||||
public static final String USERS = "test:{plain}changeme\n" +
|
||||
"admin:{plain}changeme\n" +
|
||||
"monitor:{plain}changeme";
|
||||
"admin: " + TEST_PASSWORD_HASHED + "\n" +
|
||||
"monitor:" + TEST_PASSWORD_HASHED;
|
||||
|
||||
public static final String USER_ROLES = "test:test\n" +
|
||||
"admin:admin\n" +
|
||||
@ -105,17 +120,17 @@ public class WatcherRestTests extends ElasticsearchRestTestCase {
|
||||
|
||||
public static final String ROLES =
|
||||
"test:\n" + // a user for the test infra.
|
||||
" cluster: cluster:monitor/state, cluster:monitor/health, indices:admin/template/delete, cluster:admin/repository/delete, indices:admin/template/put\n" +
|
||||
" cluster: cluster:monitor/state, cluster:monitor/health, indices:admin/template/delete, cluster:admin/repository/delete, cluster:monitor/nodes/liveness, indices:admin/template/put\n" +
|
||||
" indices:\n" +
|
||||
" '*': all\n" +
|
||||
"\n" +
|
||||
"admin:\n" +
|
||||
" cluster: manage_watcher, cluster:monitor/nodes/info, cluster:monitor/state, cluster:monitor/health, cluster:admin/repository/delete\n" +
|
||||
" cluster: manage_watcher, cluster:monitor/nodes/info, cluster:monitor/state, cluster:monitor/nodes/liveness, cluster:monitor/health, cluster:admin/repository/delete\n" +
|
||||
" indices:\n" +
|
||||
" '*': all, indices:admin/template/delete\n" +
|
||||
"\n" +
|
||||
"monitor:\n" +
|
||||
" cluster: monitor_watcher, cluster:monitor/nodes/info\n" +
|
||||
" cluster: monitor_watcher, cluster:monitor/nodes/info, cluster:monitor/nodes/liveness\n" +
|
||||
"\n"
|
||||
;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user