NamingConventionTests should test subclasses of ESIntegTestCase end with IT
These are integration tests.
This commit is contained in:
parent
9091f46602
commit
d7cf5cd6af
|
@ -26,6 +26,7 @@ import junit.framework.TestCase;
|
|||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.elasticsearch.common.SuppressForbidden;
|
||||
import org.elasticsearch.common.io.PathUtils;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.elasticsearch.test.ESTokenStreamTestCase;
|
||||
import org.junit.Ignore;
|
||||
|
@ -51,6 +52,7 @@ public class NamingConventionTests extends ESTestCase {
|
|||
final Set<Class> notImplementing = new HashSet<>();
|
||||
final Set<Class> pureUnitTest = new HashSet<>();
|
||||
final Set<Class> missingSuffix = new HashSet<>();
|
||||
final Set<Class> integTestsInDisguise = new HashSet<>();
|
||||
String[] packages = {"org.elasticsearch", "org.apache.lucene"};
|
||||
for (final String packageName : packages) {
|
||||
final String path = "/" + packageName.replace('.', '/');
|
||||
|
@ -76,12 +78,19 @@ public class NamingConventionTests extends ESTestCase {
|
|||
Class<?> clazz = loadClass(filename);
|
||||
if (Modifier.isAbstract(clazz.getModifiers()) == false && Modifier.isInterface(clazz.getModifiers()) == false) {
|
||||
if (clazz.getName().endsWith("Tests") ||
|
||||
clazz.getName().endsWith("IT") ||
|
||||
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) {
|
||||
notImplementing.add(clazz);
|
||||
}
|
||||
} else if (clazz.getName().endsWith("IT")) {
|
||||
if (isTestCase(clazz) == false) {
|
||||
notImplementing.add(clazz);
|
||||
}
|
||||
// otherwise fine
|
||||
} else if (isTestCase(clazz)) {
|
||||
missingSuffix.add(clazz);
|
||||
} else if (junit.framework.Test.class.isAssignableFrom(clazz) || hasTestAnnotation(clazz)) {
|
||||
|
@ -151,6 +160,7 @@ public class NamingConventionTests extends ESTestCase {
|
|||
pureUnitTest.isEmpty());
|
||||
assertTrue("Classes ending with Test|Tests] must subclass [" + classesToSubclass +"] " + notImplementing.toString(),
|
||||
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)
|
||||
public class SimpleNodesInfoTests extends PluginTestCase {
|
||||
public class SimpleNodesInfoIT extends PluginTestCase {
|
||||
|
||||
static final class Fields {
|
||||
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.greaterThan;
|
||||
|
||||
public class BlobStoreFormatTests extends AbstractSnapshotIntegTestCase {
|
||||
public class BlobStoreFormatIT extends AbstractSnapshotIntegTestCase {
|
||||
|
||||
private static final ParseFieldMatcher parseFieldMatcher = new ParseFieldMatcher(Settings.EMPTY);
|
||||
|
|
@ -48,7 +48,7 @@ import static org.hamcrest.Matchers.notNullValue;
|
|||
/**
|
||||
*/
|
||||
@ESIntegTestCase.ClusterScope(minNumDataNodes = 2)
|
||||
public class RepositoriesTests extends AbstractSnapshotIntegTestCase {
|
||||
public class RepositoriesIT extends AbstractSnapshotIntegTestCase {
|
||||
|
||||
@Test
|
||||
public void testRepositoryCreation() throws Exception {
|
Loading…
Reference in New Issue