Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update gradle config for new testing plugins #3

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
8 changes: 0 additions & 8 deletions x-pack/plugin/deprecation/qa/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +0,0 @@
import org.elasticsearch.gradle.test.RestIntegTestTask

apply plugin: 'elasticsearch.build'
test.enabled = false

dependencies {
api project(':test:framework')
}
22 changes: 6 additions & 16 deletions x-pack/plugin/deprecation/qa/rest/build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import org.elasticsearch.gradle.info.BuildParams

apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.esplugin'
apply plugin: 'elasticsearch.rest-resources'
apply plugin: 'elasticsearch.java-rest-test'

esplugin {
description 'Deprecated query plugin'
classname 'org.elasticsearch.xpack.deprecation.TestDeprecationPlugin'
}

dependencies {
api("com.fasterxml.jackson.core:jackson-annotations:${versions.jackson}")
api("com.fasterxml.jackson.core:jackson-databind:${versions.jackson}")
javaRestTestImplementation("com.fasterxml.jackson.core:jackson-annotations:${versions.jackson}")
javaRestTestImplementation("com.fasterxml.jackson.core:jackson-databind:${versions.jackson}")
// let the javaRestTest see the classpath of main
javaRestTestImplementation project.sourceSets.main.runtimeClasspath
}

restResources {
Expand All @@ -20,18 +19,9 @@ restResources {
}
}

testClusters.integTest {
testClusters.all {
testDistribution = 'DEFAULT'
// add the deprecated query plugin
plugin file(project(':x-pack:plugin:deprecation:qa:rest').tasks.bundlePlugin.archiveFile)
setting 'xpack.security.enabled', 'false'
}

test.enabled = false

check.dependsOn integTest

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

8 changes: 0 additions & 8 deletions x-pack/plugin/deprecation/qa/rest/licenses/jackson-LICENSE

This file was deleted.

20 changes: 0 additions & 20 deletions x-pack/plugin/deprecation/qa/rest/licenses/jackson-NOTICE

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@
import java.util.stream.Collectors;

import static org.elasticsearch.test.hamcrest.RegexMatcher.matches;
import static org.elasticsearch.xpack.deprecation.TestDeprecationHeaderRestAction.TEST_DEPRECATED_SETTING_TRUE1;
import static org.elasticsearch.xpack.deprecation.TestDeprecationHeaderRestAction.TEST_DEPRECATED_SETTING_TRUE2;
import static org.elasticsearch.xpack.deprecation.TestDeprecationHeaderRestAction.TEST_NOT_DEPRECATED_SETTING;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
Expand All @@ -59,10 +56,19 @@ public void testDeprecatedSettingsReturnWarnings() throws IOException {
XContentBuilder builder = JsonXContent.contentBuilder()
.startObject()
.startObject("transient")
.field(TEST_DEPRECATED_SETTING_TRUE1.getKey(), !TEST_DEPRECATED_SETTING_TRUE1.getDefault(Settings.EMPTY))
.field(TEST_DEPRECATED_SETTING_TRUE2.getKey(), !TEST_DEPRECATED_SETTING_TRUE2.getDefault(Settings.EMPTY))
.field(
TestDeprecationHeaderRestAction.TEST_DEPRECATED_SETTING_TRUE1.getKey(),
!TestDeprecationHeaderRestAction.TEST_DEPRECATED_SETTING_TRUE1.getDefault(Settings.EMPTY)
)
.field(
TestDeprecationHeaderRestAction.TEST_DEPRECATED_SETTING_TRUE2.getKey(),
!TestDeprecationHeaderRestAction.TEST_DEPRECATED_SETTING_TRUE2.getDefault(Settings.EMPTY)
)
// There should be no warning for this field
.field(TEST_NOT_DEPRECATED_SETTING.getKey(), !TEST_NOT_DEPRECATED_SETTING.getDefault(Settings.EMPTY))
.field(
TestDeprecationHeaderRestAction.TEST_NOT_DEPRECATED_SETTING.getKey(),
!TestDeprecationHeaderRestAction.TEST_NOT_DEPRECATED_SETTING.getDefault(Settings.EMPTY)
)
.endObject()
.endObject();

Expand All @@ -73,7 +79,10 @@ public void testDeprecatedSettingsReturnWarnings() throws IOException {
final List<String> deprecatedWarnings = getWarningHeaders(response.getHeaders());
final List<Matcher<String>> headerMatchers = new ArrayList<>(2);

for (Setting<Boolean> setting : List.of(TEST_DEPRECATED_SETTING_TRUE1, TEST_DEPRECATED_SETTING_TRUE2)) {
for (Setting<Boolean> setting : List.of(
TestDeprecationHeaderRestAction.TEST_DEPRECATED_SETTING_TRUE1,
TestDeprecationHeaderRestAction.TEST_DEPRECATED_SETTING_TRUE2
)) {
headerMatchers.add(
equalTo(
"["
Expand Down Expand Up @@ -170,14 +179,14 @@ private void doTestDeprecationWarningsAppearInHeaders() throws IOException {

// deprecated settings should also trigger a deprecation warning
final List<Setting<Boolean>> settings = new ArrayList<>(3);
settings.add(TEST_DEPRECATED_SETTING_TRUE1);
settings.add(TestDeprecationHeaderRestAction.TEST_DEPRECATED_SETTING_TRUE1);

if (randomBoolean()) {
settings.add(TEST_DEPRECATED_SETTING_TRUE2);
settings.add(TestDeprecationHeaderRestAction.TEST_DEPRECATED_SETTING_TRUE2);
}

if (useNonDeprecatedSetting) {
settings.add(TEST_NOT_DEPRECATED_SETTING);
settings.add(TestDeprecationHeaderRestAction.TEST_NOT_DEPRECATED_SETTING);
}

Collections.shuffle(settings, random());
Expand Down Expand Up @@ -216,7 +225,7 @@ public void testDeprecationMessagesCanBeIndexed() throws Exception {
configureWriteDeprecationLogsToIndex(true);

Request request = new Request("GET", "/_test_cluster/deprecated_settings");
request.setEntity(buildSettingsRequest(List.of(TEST_DEPRECATED_SETTING_TRUE1), true));
request.setEntity(buildSettingsRequest(List.of(TestDeprecationHeaderRestAction.TEST_DEPRECATED_SETTING_TRUE1), true));
assertOK(client().performRequest(request));

assertBusy(() -> {
Expand Down