Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 35 additions & 8 deletions x-pack/plugin/ent-search/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
apply plugin: 'elasticsearch.internal-es-plugin'
apply plugin: 'elasticsearch.internal-cluster-test'
apply plugin: 'elasticsearch.legacy-java-rest-test'
apply plugin: 'elasticsearch.internal-java-rest-test'
apply plugin: 'elasticsearch.internal-yaml-rest-test'
apply plugin: 'elasticsearch.yaml-rest-compat-test'

esplugin {
name = 'x-pack-ent-search'
Expand Down Expand Up @@ -35,25 +37,50 @@ dependencies {
javaRestTestImplementation(project(path: xpackModule('core')))
javaRestTestImplementation(testArtifact(project(xpackModule('core'))))
javaRestTestImplementation(project(':modules:lang-mustache'))

yamlRestTestImplementation(testArtifact(project(xpackModule('core'))))
}

testClusters.configureEach {
testDistribution = 'DEFAULT'
setting 'xpack.security.enabled', 'true'
setting 'xpack.security.autoconfiguration.enabled', 'false'
user username: 'x_pack_rest_user', password: 'x-pack-test-password'
restResources {
restApi {
include '_common',
'bulk',
'cluster',
'connector',
'nodes',
'indices',
'index',
'query_rules',
'search_application',
'xpack',
'security',
'search',
'ml'
}
}

tasks.named("dependencyLicenses").configure {
tasks.named("dependencyLicenses") {
mapping from: /jackson.*/, to: 'jackson'
}

tasks.named("thirdPartyAudit").configure {
tasks.named("thirdPartyAudit") {
ignoreMissingClasses(
// [missing classes] SLF4j includes an optional class that depends on an extension class (!)
'org.slf4j.ext.EventData'
)
}

tasks.named("yamlRestTest") {
usesDefaultDistribution("uses the xpack/usage api")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to kill our ability to use the integ-test distribution. I've already hit more than one of these.

@rjernst Is there a way we could refactor XpackUsageFeatureAction such that these things are picked up when plugins register them rather than keeping a hard-coded list of them? We allow overriding this in internal cluster tests I assume specifically becuase this is a pain but there's no such way to do that for rest tests. This basically means any project that has a test that relies on the usage api cannot use the integ-test distribution.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. The way is to make xpack core actually extensible (it claims so now, but has no extensions). I can try to work this out.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same issues exists with the "info" API here.

}

tasks.named("yamlRestCompatTestTransform") { task ->
// Behavioral Analytics is deprecated with 9.0.0.
task.addAllowedWarning("Behavioral Analytics is deprecated and will be removed in a future release.")
}

addQaCheckDependencies(project)

artifacts {
restXpackTests(new File(projectDir, "src/yamlRestTest/resources/rest-api-spec/test"))
}
47 changes: 0 additions & 47 deletions x-pack/plugin/ent-search/qa/rest/build.gradle

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
import org.elasticsearch.common.util.concurrent.ThreadContext;
import org.elasticsearch.common.xcontent.XContentHelper;
import org.elasticsearch.test.SecuritySettingsSourceField;
import org.elasticsearch.test.cluster.ElasticsearchCluster;
import org.elasticsearch.test.rest.ESRestTestCase;
import org.elasticsearch.xcontent.XContentBuilder;
import org.elasticsearch.xcontent.XContentType;
import org.elasticsearch.xcontent.json.JsonXContent;
import org.junit.ClassRule;

import java.io.IOException;
import java.util.Map;
Expand All @@ -28,6 +30,14 @@

public class ConnectorSecretsSystemIndexIT extends ESRestTestCase {

@ClassRule
public static ElasticsearchCluster cluster = ElasticsearchCluster.local()
.module("x-pack-ent-search")
.setting("xpack.security.enabled", "true")
.setting("xpack.security.autoconfiguration.enabled", "false")
.user("x_pack_rest_user", "x-pack-test-password")
.build();

static final String BASIC_AUTH_VALUE = basicAuthHeaderValue(
"x_pack_rest_user",
SecuritySettingsSourceField.TEST_PASSWORD_SECURE_STRING
Expand Down Expand Up @@ -91,4 +101,9 @@ private String getPostSecretJson() throws IOException {
private Map<String, Object> getResponseMap(Response response) throws IOException {
return XContentHelper.convertToMap(XContentType.JSON.xContent(), EntityUtils.toString(response.getEntity()), false);
}

@Override
protected String getTestRestCluster() {
return cluster.getHttpAddresses();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,28 @@
import org.elasticsearch.common.settings.SecureString;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.concurrent.ThreadContext;
import org.elasticsearch.test.cluster.ElasticsearchCluster;
import org.elasticsearch.test.cluster.local.distribution.DistributionType;
import org.elasticsearch.test.cluster.util.resource.Resource;
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
import org.junit.ClassRule;

public class EnterpriseSearchRestIT extends ESClientYamlSuiteTestCase {

@ClassRule
public static ElasticsearchCluster cluster = ElasticsearchCluster.local()
.distribution(DistributionType.DEFAULT)
.setting("xpack.security.enabled", "true")
.setting("xpack.security.autoconfiguration.enabled", "false")
.setting("xpack.license.self_generated.type", "trial")
.rolesFile(Resource.fromClasspath("roles.yml"))
.user("entsearch-superuser", "entsearch-superuser-password", "superuser", false)
.user("entsearch-admin", "entsearch-admin-password", "admin", false)
.user("entsearch-user", "entsearch-user-password", "user", false)
.user("entsearch-unprivileged", "entsearch-unprivileged-password", "unprivileged", false)
.build();

public EnterpriseSearchRestIT(final ClientYamlTestCandidate testCandidate) {
super(testCandidate);
}
Expand All @@ -37,4 +54,9 @@ protected Settings restClientSettings() {
final String value = basicAuthHeaderValue("entsearch-admin", new SecureString("entsearch-admin-password".toCharArray()));
return Settings.builder().put(ThreadContext.PREFIX + ".Authorization", value).build();
}

@Override
protected String getTestRestCluster() {
return cluster.getHttpAddresses();
}
}
2 changes: 1 addition & 1 deletion x-pack/rest-resources-zip/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ dependencies {
freeCompatTests project(path: ':rest-api-spec', configuration: 'restCompatTests')
platinumTests project(path: ':x-pack:plugin', configuration: 'restXpackTests')
platinumTests project(path: ':x-pack:plugin:eql:qa:rest', configuration: 'restXpackTests')
platinumTests project(path: ':x-pack:plugin:ent-search:qa:rest', configuration: 'restXpackTests')
platinumTests project(path: ':x-pack:plugin:ent-search', configuration: 'restXpackTests')
platinumCompatTests project(path: ':x-pack:plugin', configuration: 'restCompatTests')
platinumCompatTests project(path: ':x-pack:plugin:eql:qa:rest', configuration: 'restCompatTests')
}
Expand Down