Switch from standalone-test to standalone-rest-test

standalone-rest-test doesn't configure unit tests and for these
integ test only tests, that is what we want.
This commit is contained in:
Nik Everett 2017-01-04 14:26:55 -05:00 committed by Luca Cavanna
parent 812f63e5ef
commit 232af512f4
18 changed files with 53 additions and 23 deletions

View File

@ -55,8 +55,10 @@ class BuildPlugin implements Plugin<Project> {
@Override
void apply(Project project) {
if (project.pluginManager.hasPlugin('elasticsearch.standalone-test')) {
throw new InvalidUserDataException('elasticsearch.standalone-test and elasticsearch.build are mutually exclusive')
if (project.pluginManager.hasPlugin('elasticsearch.standalone-rest-test')) {
throw new InvalidUserDataException('elasticsearch.standalone-test, '
+ 'elasticearch.standalone-rest-test, and elasticsearch.build '
+ 'are mutually exclusive')
}
project.pluginManager.apply('java')
project.pluginManager.apply('carrotsearch.randomized-testing')

View File

@ -30,7 +30,7 @@ public class DocsTestPlugin extends RestTestPlugin {
@Override
public void apply(Project project) {
project.pluginManager.apply('elasticsearch.standalone-test')
project.pluginManager.apply('elasticsearch.standalone-rest-test')
super.apply(project)
Map<String, String> defaultSubstitutions = [
/* These match up with the asciidoc syntax for substitutions but

View File

@ -25,14 +25,14 @@ import org.gradle.api.Project
/**
* Adds support for starting an Elasticsearch cluster before running integration
* tests. Used in conjunction with {@link StandaloneTestBasePlugin} for qa
* tests. Used in conjunction with {@link StandaloneRestTestPlugin} for qa
* projects and in conjunction with {@link BuildPlugin} for testing the rest
* client.
*/
public class RestTestPlugin implements Plugin<Project> {
List REQUIRED_PLUGINS = [
'elasticsearch.build',
'elasticsearch.standalone-test']
'elasticsearch.standalone-rest-test']
@Override
public void apply(Project project) {

View File

@ -30,13 +30,19 @@ import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.plugins.JavaBasePlugin
/** Configures the build to have a rest integration test. */
public class StandaloneTestBasePlugin implements Plugin<Project> {
/**
* Configures the build to compile tests against Elasticsearch's test framework
* and run REST tests. Use BuildPlugin if you want to build main code as well
* as tests.
*/
public class StandaloneRestTestPlugin implements Plugin<Project> {
@Override
public void apply(Project project) {
if (project.pluginManager.hasPlugin('elasticsearch.build')) {
throw new InvalidUserDataException('elasticsearch.standalone-test and elasticsearch.build are mutually exclusive')
throw new InvalidUserDataException('elasticsearch.standalone-test, '
+ 'elasticsearch.standalone-test, and elasticsearch.build are '
+ 'mutually exclusive')
}
project.pluginManager.apply(JavaBasePlugin)
project.pluginManager.apply(RandomizedTestingPlugin)

View File

@ -25,12 +25,15 @@ import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.plugins.JavaBasePlugin
/** A plugin to add tests only. Used for QA tests that run arbitrary unit tests. */
/**
* Configures the build to compile against Elasticsearch's test framework and
* run integration and unit tests. Use BuildPlugin if you want to build main
* code as well as tests. */
public class StandaloneTestPlugin implements Plugin<Project> {
@Override
public void apply(Project project) {
project.pluginManager.apply(StandaloneTestBasePlugin)
project.pluginManager.apply(StandaloneRestTestPlugin)
Map testOptions = [
name: 'test',

View File

@ -0,0 +1,20 @@
#
# Licensed to Elasticsearch under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
implementation-class=org.elasticsearch.gradle.test.StandaloneRestTestPlugin

View File

@ -1,5 +1,5 @@
/*
* Licensed to Elasticsearch under one or more contributor
// * Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
@ -104,7 +104,7 @@ subprojects {
/*****************************************************************************
* Rest test config *
*****************************************************************************/
apply plugin: 'elasticsearch.standalone-test'
apply plugin: 'elasticsearch.standalone-rest-test'
apply plugin: 'elasticsearch.rest-test'
project.integTest {
dependsOn project.assemble

View File

@ -17,7 +17,7 @@
* under the License.
*/
apply plugin: 'elasticsearch.standalone-test'
apply plugin: 'elasticsearch.standalone-rest-test'
apply plugin: 'elasticsearch.rest-test'
/* This project runs the core REST tests against a 2 node cluster where one of the nodes has a different minor.

View File

@ -23,4 +23,3 @@
*/
apply plugin: 'elasticsearch.standalone-test'

View File

@ -17,7 +17,7 @@
* under the License.
*/
apply plugin: 'elasticsearch.standalone-test'
apply plugin: 'elasticsearch.standalone-rest-test'
apply plugin: 'elasticsearch.rest-test'
// TODO: this test works, but it isn't really a rest test...should we have another plugin for "non rest test that just needs N clusters?"

View File

@ -17,7 +17,7 @@
* under the License.
*/
apply plugin: 'elasticsearch.standalone-test'
apply plugin: 'elasticsearch.standalone-rest-test'
apply plugin: 'elasticsearch.rest-test'
dependencies {

View File

@ -17,7 +17,7 @@
* under the License.
*/
apply plugin: 'elasticsearch.standalone-test'
apply plugin: 'elasticsearch.standalone-rest-test'
apply plugin: 'elasticsearch.rest-test'
dependencies {

View File

@ -17,7 +17,7 @@
* under the License.
*/
apply plugin: 'elasticsearch.standalone-test'
apply plugin: 'elasticsearch.standalone-rest-test'
apply plugin: 'elasticsearch.rest-test'
dependencies {

View File

@ -17,7 +17,7 @@
* under the License.
*/
apply plugin: 'elasticsearch.standalone-test'
apply plugin: 'elasticsearch.standalone-rest-test'
apply plugin: 'elasticsearch.rest-test'
integTest {

View File

@ -19,7 +19,7 @@
import org.elasticsearch.gradle.MavenFilteringHack
apply plugin: 'elasticsearch.standalone-test'
apply plugin: 'elasticsearch.standalone-rest-test'
apply plugin: 'elasticsearch.rest-test'
ext.pluginsCount = 0

View File

@ -17,7 +17,7 @@
* under the License.
*/
apply plugin: 'elasticsearch.standalone-test'
apply plugin: 'elasticsearch.standalone-rest-test'
apply plugin: 'elasticsearch.rest-test'
integTest {

View File

@ -21,7 +21,7 @@ import org.elasticsearch.gradle.test.ClusterConfiguration
import org.elasticsearch.gradle.test.ClusterFormationTasks
import org.elasticsearch.gradle.test.NodeInfo
apply plugin: 'elasticsearch.standalone-test'
apply plugin: 'elasticsearch.standalone-rest-test'
apply plugin: 'elasticsearch.rest-test'
List<NodeInfo> oneNodes