Skip to content
This repository has been archived by the owner on Oct 1, 2018. It is now read-only.

Commit

Permalink
Move tests to elasticsearch test framework
Browse files Browse the repository at this point in the history
Closes #16.
  • Loading branch information
dadoonet committed Jan 15, 2014
1 parent dbcb2d7 commit e6e0097
Show file tree
Hide file tree
Showing 8 changed files with 222 additions and 159 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -8,3 +8,4 @@
/.project
/.classpath
/.settings
.local-execution-hints.log
119 changes: 104 additions & 15 deletions pom.xml
Expand Up @@ -30,7 +30,13 @@
</parent>

<properties>
<elasticsearch.version>0.90.2</elasticsearch.version>
<elasticsearch.version>0.90.10</elasticsearch.version>
<lucene.version>4.6.0</lucene.version>
<tests.jvms>1</tests.jvms>
<tests.shuffle>true</tests.shuffle>
<tests.output>onerror</tests.output>
<tests.client.ratio></tests.client.ratio>
<es.logger.level>INFO</es.logger.level>
</properties>

<repositories>
Expand All @@ -41,6 +47,13 @@
</repositories>

<dependencies>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-test-framework</artifactId>
<version>${lucene.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
Expand All @@ -63,16 +76,10 @@
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.3.1</version>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>${elasticsearch.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>

Expand Down Expand Up @@ -122,13 +129,95 @@
</executions>
</plugin>
<plugin>
<groupId>com.carrotsearch.randomizedtesting</groupId>
<artifactId>junit4-maven-plugin</artifactId>
<version>2.0.12</version>
<executions>
<execution>
<id>tests</id>
<phase>test</phase>
<goals>
<goal>junit4</goal>
</goals>
<configuration>
<heartbeat>20</heartbeat>
<jvmOutputAction>pipe,warn</jvmOutputAction>
<leaveTemporary>true</leaveTemporary>
<listeners>
<report-ant-xml mavenExtensions="true"
dir="${project.build.directory}/surefire-reports"/>
<report-text
showThrowable="true"
showStackTraces="true"
showOutput="${tests.output}"
showStatusOk="false"
showStatusError="true"
showStatusFailure="true"
showStatusIgnored="true"
showSuiteSummary="true"
timestamps="false"/>
<report-execution-times file="${basedir}/.local-execution-hints.log"/>
</listeners>
<assertions>
<enable/>
</assertions>
<parallelism>${tests.jvms}</parallelism>
<balancers>
<execution-times>
<fileset dir="${basedir}" includes=".local-execution-hints.log"/>
</execution-times>
</balancers>
<includes>
<include>**/*Tests.class</include>
<include>**/*Test.class</include>
</includes>
<excludes>
<exclude>**/Abstract*.class</exclude>
<exclude>**/*StressTest.class</exclude>
</excludes>
<jvmArgs>
<param>-Xmx512m</param>
<param>-XX:MaxDirectMemorySize=512m</param>
<param>-Des.logger.prefix=</param>
</jvmArgs>
<shuffleOnSlave>${tests.shuffle}</shuffleOnSlave>
<sysouts>${tests.verbose}</sysouts>
<seed>${tests.seed}</seed>
<haltOnFailure>${tests.failfast}</haltOnFailure>
<systemProperties>
<!-- RandomizedTesting library system properties -->
<tests.iters>${tests.iters}</tests.iters>
<tests.maxfailures>${tests.maxfailures}</tests.maxfailures>
<tests.failfast>${tests.failfast}</tests.failfast>
<tests.class>${tests.class}</tests.class>
<tests.method>${tests.method}</tests.method>
<tests.nightly>${tests.nightly}</tests.nightly>
<tests.badapples>${tests.badapples}</tests.badapples>
<tests.weekly>${tests.weekly}</tests.weekly>
<tests.slow>${tests.slow}</tests.slow>
<tests.awaitsfix>${tests.awaitsfix}</tests.awaitsfix>
<tests.slow>${tests.slow}</tests.slow>
<tests.timeoutSuite>${tests.timeoutSuite}</tests.timeoutSuite>
<tests.showSuccess>${tests.showSuccess}</tests.showSuccess>
<tests.integration>${tests.integration}</tests.integration>
<tests.cluster_seed>${tests.cluster_seed}</tests.cluster_seed>
<tests.client.ratio>${tests.client.ratio}</tests.client.ratio>
<es.node.local>${env.ES_TEST_LOCAL}</es.node.local>
<es.node.mode>${es.node.mode}</es.node.mode>
<es.logger.level>${es.logger.level}</es.logger.level>
<java.awt.headless>true</java.awt.headless>
</systemProperties>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<!-- we skip surefire to work with randomized testing above -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.11</version>
<version>2.15</version>
<configuration>
<includes>
<include>**/*Tests.java</include>
</includes>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>
Expand Down
Expand Up @@ -21,10 +21,10 @@ package org.elasticsearch.groovy.test.client

import org.elasticsearch.groovy.node.GNode
import org.elasticsearch.groovy.node.GNodeBuilder
import org.junit.After
import org.junit.Before
import org.junit.Test

import org.testng.annotations.AfterMethod
import org.testng.annotations.BeforeMethod
import org.testng.annotations.Test
import static org.hamcrest.MatcherAssert.assertThat
import static org.hamcrest.Matchers.equalTo

Expand All @@ -36,8 +36,8 @@ class BuilderActionsTests {

def GNode node

@BeforeMethod
protected void setUp() {
@Before
public void startNode() {
GNodeBuilder nodeBuilder = new GNodeBuilder()
nodeBuilder.settings {
node {
Expand All @@ -51,8 +51,8 @@ class BuilderActionsTests {
node = nodeBuilder.node()
}

@AfterMethod
protected void tearDown() {
@After
public void closeNode() {
node.close()
}

Expand Down
Expand Up @@ -19,15 +19,16 @@

package org.elasticsearch.groovy.test.client

import org.elasticsearch.action.index.IndexRequest
import org.elasticsearch.action.index.IndexResponse
import org.elasticsearch.groovy.node.GNode
import org.elasticsearch.groovy.node.GNodeBuilder
import org.junit.After
import org.junit.Before
import org.junit.Test

import java.util.concurrent.CountDownLatch
import org.elasticsearch.action.index.IndexRequest
import org.elasticsearch.action.index.IndexResponse
import org.testng.annotations.AfterMethod
import org.testng.annotations.BeforeMethod
import org.testng.annotations.Test

import static org.elasticsearch.client.Requests.indexRequest
import static org.hamcrest.MatcherAssert.assertThat
import static org.hamcrest.Matchers.equalTo
Expand All @@ -39,8 +40,8 @@ class DifferentApiExecutionTests {

def GNode node

@BeforeMethod
protected void setUp() {
@Before
public void startNode() {
GNodeBuilder nodeBuilder = new GNodeBuilder()
nodeBuilder.settings {
node {
Expand All @@ -54,8 +55,8 @@ class DifferentApiExecutionTests {
node = nodeBuilder.node()
}

@AfterMethod
protected void tearDown() {
@After
public void closeNode() {
node.close()
}

Expand Down
Expand Up @@ -21,10 +21,10 @@ package org.elasticsearch.groovy.test.client

import org.elasticsearch.groovy.node.GNode
import org.elasticsearch.groovy.node.GNodeBuilder
import org.junit.After
import org.junit.Before
import org.junit.Test

import org.testng.annotations.AfterMethod
import org.testng.annotations.BeforeMethod
import org.testng.annotations.Test
import static org.hamcrest.MatcherAssert.assertThat
import static org.hamcrest.Matchers.equalTo

Expand All @@ -35,8 +35,8 @@ class SimpleActionsTests {

def GNode node

@BeforeMethod
protected void setUp() {
@Before
public void startNode() {
GNodeBuilder nodeBuilder = new GNodeBuilder()
nodeBuilder.settings {
node {
Expand All @@ -50,8 +50,8 @@ class SimpleActionsTests {
node = nodeBuilder.node()
}

@AfterMethod
protected void tearDown() {
@After
public void closeNode() {
node.close()
}

Expand Down Expand Up @@ -146,11 +146,8 @@ class SimpleActionsTests {
index 'test'
type 'type1'
id '1'
source {
doc {
test = "new value"
}
}
doc ( 'test', 'new value' )

}
assertThat updateR.response.index, equalTo('test')
assertThat updateR.response.type, equalTo('type1')
Expand Down
Expand Up @@ -21,7 +21,7 @@ package org.elasticsearch.groovy.test.node

import org.elasticsearch.groovy.node.GNode
import org.elasticsearch.groovy.node.GNodeBuilder
import org.testng.annotations.Test
import org.junit.Test

import static org.elasticsearch.groovy.node.GNodeBuilder.nodeBuilder

Expand Down
Expand Up @@ -19,29 +19,24 @@

package org.elasticsearch.script.groovy;

import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.util.concurrent.jsr166y.ThreadLocalRandom;
import org.elasticsearch.script.ExecutableScript;
import org.testng.annotations.Test;
import org.elasticsearch.test.ElasticsearchTestCase;
import org.junit.Test;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.atomic.AtomicBoolean;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;

/**
*
*/
@Test
public class GroovyScriptMultiThreadedTest {

protected final ESLogger logger = Loggers.getLogger(getClass());
public class GroovyScriptMultiThreadedTest extends ElasticsearchTestCase {

@Test
public void testExecutableNoRuntimeParams() throws Exception {
Expand Down

0 comments on commit e6e0097

Please sign in to comment.