Merge pull request #12625 from rmuir/git_sucks
NamingConventionTests should test subclasses of ESIntegTestCase end with IT
This commit is contained in:
commit
3b7316fb8d
|
@ -26,6 +26,7 @@ import junit.framework.TestCase;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
import org.apache.lucene.util.LuceneTestCase;
|
||||||
import org.elasticsearch.common.SuppressForbidden;
|
import org.elasticsearch.common.SuppressForbidden;
|
||||||
import org.elasticsearch.common.io.PathUtils;
|
import org.elasticsearch.common.io.PathUtils;
|
||||||
|
import org.elasticsearch.test.ESIntegTestCase;
|
||||||
import org.elasticsearch.test.ESTestCase;
|
import org.elasticsearch.test.ESTestCase;
|
||||||
import org.elasticsearch.test.ESTokenStreamTestCase;
|
import org.elasticsearch.test.ESTokenStreamTestCase;
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
|
@ -51,6 +52,7 @@ public class NamingConventionTests extends ESTestCase {
|
||||||
final Set<Class> notImplementing = new HashSet<>();
|
final Set<Class> notImplementing = new HashSet<>();
|
||||||
final Set<Class> pureUnitTest = new HashSet<>();
|
final Set<Class> pureUnitTest = new HashSet<>();
|
||||||
final Set<Class> missingSuffix = new HashSet<>();
|
final Set<Class> missingSuffix = new HashSet<>();
|
||||||
|
final Set<Class> integTestsInDisguise = new HashSet<>();
|
||||||
String[] packages = {"org.elasticsearch", "org.apache.lucene"};
|
String[] packages = {"org.elasticsearch", "org.apache.lucene"};
|
||||||
for (final String packageName : packages) {
|
for (final String packageName : packages) {
|
||||||
final String path = "/" + packageName.replace('.', '/');
|
final String path = "/" + packageName.replace('.', '/');
|
||||||
|
@ -76,12 +78,19 @@ public class NamingConventionTests extends ESTestCase {
|
||||||
Class<?> clazz = loadClass(filename);
|
Class<?> clazz = loadClass(filename);
|
||||||
if (Modifier.isAbstract(clazz.getModifiers()) == false && Modifier.isInterface(clazz.getModifiers()) == false) {
|
if (Modifier.isAbstract(clazz.getModifiers()) == false && Modifier.isInterface(clazz.getModifiers()) == false) {
|
||||||
if (clazz.getName().endsWith("Tests") ||
|
if (clazz.getName().endsWith("Tests") ||
|
||||||
clazz.getName().endsWith("IT") ||
|
|
||||||
clazz.getName().endsWith("Test")) { // don't worry about the ones that match the pattern
|
clazz.getName().endsWith("Test")) { // don't worry about the ones that match the pattern
|
||||||
|
|
||||||
|
if (ESIntegTestCase.class.isAssignableFrom(clazz)) {
|
||||||
|
integTestsInDisguise.add(clazz);
|
||||||
|
}
|
||||||
if (isTestCase(clazz) == false) {
|
if (isTestCase(clazz) == false) {
|
||||||
notImplementing.add(clazz);
|
notImplementing.add(clazz);
|
||||||
}
|
}
|
||||||
|
} else if (clazz.getName().endsWith("IT")) {
|
||||||
|
if (isTestCase(clazz) == false) {
|
||||||
|
notImplementing.add(clazz);
|
||||||
|
}
|
||||||
|
// otherwise fine
|
||||||
} else if (isTestCase(clazz)) {
|
} else if (isTestCase(clazz)) {
|
||||||
missingSuffix.add(clazz);
|
missingSuffix.add(clazz);
|
||||||
} else if (junit.framework.Test.class.isAssignableFrom(clazz) || hasTestAnnotation(clazz)) {
|
} else if (junit.framework.Test.class.isAssignableFrom(clazz) || hasTestAnnotation(clazz)) {
|
||||||
|
@ -151,6 +160,7 @@ public class NamingConventionTests extends ESTestCase {
|
||||||
pureUnitTest.isEmpty());
|
pureUnitTest.isEmpty());
|
||||||
assertTrue("Classes ending with Test|Tests] must subclass [" + classesToSubclass +"] " + notImplementing.toString(),
|
assertTrue("Classes ending with Test|Tests] must subclass [" + classesToSubclass +"] " + notImplementing.toString(),
|
||||||
notImplementing.isEmpty());
|
notImplementing.isEmpty());
|
||||||
|
assertTrue("Subclasses of ESIntegTestCase should end with IT as they are integration tests: " + integTestsInDisguise, integTestsInDisguise.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -36,7 +36,7 @@ import static org.hamcrest.Matchers.*;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ClusterScope(scope= Scope.TEST, numDataNodes =0)
|
@ClusterScope(scope= Scope.TEST, numDataNodes =0)
|
||||||
public class SimpleNodesInfoTests extends PluginTestCase {
|
public class SimpleNodesInfoIT extends PluginTestCase {
|
||||||
|
|
||||||
static final class Fields {
|
static final class Fields {
|
||||||
static final String SITE_PLUGIN = "dummy";
|
static final String SITE_PLUGIN = "dummy";
|
|
@ -49,7 +49,7 @@ import java.util.concurrent.*;
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
import static org.hamcrest.Matchers.greaterThan;
|
import static org.hamcrest.Matchers.greaterThan;
|
||||||
|
|
||||||
public class BlobStoreFormatTests extends AbstractSnapshotIntegTestCase {
|
public class BlobStoreFormatIT extends AbstractSnapshotIntegTestCase {
|
||||||
|
|
||||||
private static final ParseFieldMatcher parseFieldMatcher = new ParseFieldMatcher(Settings.EMPTY);
|
private static final ParseFieldMatcher parseFieldMatcher = new ParseFieldMatcher(Settings.EMPTY);
|
||||||
|
|
|
@ -48,7 +48,7 @@ import static org.hamcrest.Matchers.notNullValue;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
@ESIntegTestCase.ClusterScope(minNumDataNodes = 2)
|
@ESIntegTestCase.ClusterScope(minNumDataNodes = 2)
|
||||||
public class RepositoriesTests extends AbstractSnapshotIntegTestCase {
|
public class RepositoriesIT extends AbstractSnapshotIntegTestCase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRepositoryCreation() throws Exception {
|
public void testRepositoryCreation() throws Exception {
|
Loading…
Reference in New Issue