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

Reorganization of testing #6

Merged
merged 1 commit into from
Dec 28, 2017
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
30 changes: 24 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,31 @@ sudo: false
dist: trusty
language: java
jdk: oraclejdk8
install: true # remove default
addons:
postgresql: "9.3" # min supported version
cache:
directories:
- $HOME/.m2

services:
- mysql

install: true # disable default because no need to do the mvn install before mvn verify

before_script:
- psql -c "create user bitcoinj with password 'password';" -U postgres
- psql -c 'create database bitcoinj_test owner bitcoinj;' -U postgres
- mysql -e 'CREATE DATABASE bitcoinj_test;'
- mysql -e "grant all PRIVILEGES on bitcoinj_test.* to 'bitcoinj' identified by 'password';"
- mysql -e 'SET GLOBAL max_allowed_packet=20971520;'

script:
- mvn -q clean install -Pno-network
- jdk_switcher use openjdk7
- cd core
- mvn -q clean package -Pno-network
- mvn verify -Ptravis -Dmaven.javadoc.skip=true
# to run one specific test - in this case only testFirst100kBlocksWithCustomSchema test in PostgresFullPrunedBlockChainIT class
# - mvn clean verify -Ptravis -Dmaven.javadoc.skip=true -Dit.test=PostgresFullPrunedBlockChainIT#testFirst100kBlocksWithCustomSchema -Dtest=nothing -DfailIfNoTests=false
# run only mysql integration tests
# - mvn clean verify -Ptravis -Dmaven.javadoc.skip=true -Dit.test=MySQLFullPrunedBlockChainIT -Dtest=nothing -DfailIfNoTests=false

after_success:
- cd ../core
- cd core
- mvn jacoco:report coveralls:report
171 changes: 106 additions & 65 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,27 @@
</developers>

<profiles>
<profile>
<id>dev</id> <!-- default profile -->
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<excludes>
<!-- exclude postgres and mysql tests, these need environment setup -->
<exclude>**/PostgresFullPrunedBlockChainIT.java</exclude>
<exclude>**/MySQLFullPrunedBlockChainIT.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>update-protobuf</id>
<activation>
Expand Down Expand Up @@ -92,7 +113,7 @@
</build>
</profile>
<profile>
<id>no-network</id>
<id>travis</id> <!-- profile for travis CI testing -->
<build>
<plugins>
<plugin>
Expand All @@ -105,6 +126,10 @@
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
Expand Down Expand Up @@ -183,6 +208,8 @@
<!-- classifier is "null" if not present -->
<urns>
<urn>cglib:cglib-nodep:2.2:jar:null:test:59afed7ab65e7ec6585d5bc60556c3cbd203532b</urn>
<urn>ch.qos.logback:logback-classic:1.2.3:jar:null:test:7c4f3c474fb2c041d8028740440937705ebb473a</urn>
<urn>ch.qos.logback:logback-core:1.2.3:jar:null:test:864344400c3d4d92dfeb0a305dc87d953677c03c</urn>
<urn>com.fasterxml.jackson.core:jackson-annotations:2.5.0:jar:null:test:a2a55a3375bc1cef830ca426d68d2ea22961190e</urn>
<urn>com.fasterxml.jackson.core:jackson-core:2.5.1:jar:null:test:e2a00ad1d7e540ec395e9296a34da484c8888d4d</urn>
<urn>com.fasterxml.jackson.core:jackson-databind:2.5.2:jar:null:test:2b4dd13fbe6f8c6b146d4c3b7fd70862f136802d</urn>
Expand Down Expand Up @@ -275,12 +302,15 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.5.201505241946</version>
<version>0.7.9</version>
<configuration>
<excludes>
<exclude>**/Protos*.class</exclude> <!-- Exclude generated protobuf classes -->
<exclude>**/ClientState*</exclude> <!-- also protobuf -->
<exclude>**/ServerState*</exclude> <!-- also protobuf -->
<exclude>org/bitcoinj/jni/*</exclude> <!-- Exclude JNI classes -->
<exclude>org/bitcoin/*</exclude> <!-- Exclude native classes -->
<exclude>org/bitcoin/**/*</exclude> <!-- Exclude native classes -->
<exclude>**/HttpDiscovery.class</exclude> <!-- not used in Bitcoin Cash -->
</excludes>
</configuration>
<executions>
Expand All @@ -290,47 +320,58 @@
<goal>prepare-agent</goal>
</goals>
<configuration>
<destFile>${project.build.directory}/coverage-reports/jacoco.exec</destFile>
<destFile>${project.build.directory}/jacoco.exec</destFile>
<propertyName>surefireArgLine</propertyName>
</configuration>
</execution>
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<id>pre-integration-test</id>
<phase>pre-integration-test</phase>
<goals>
<goal>report</goal>
<goal>prepare-agent</goal>
</goals>
<configuration>
<dataFile>${project.build.directory}/coverage-reports/jacoco.exec</dataFile>
<outputDirectory>${project.reporting.outputDirectory}/jacoco</outputDirectory>
<destFile>${project.build.directory}/jacoco.exec</destFile>
<propertyName>failsafeArgLine</propertyName>
</configuration>
</execution>
<execution>
<id>default-report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>

<!-- Unit tests plugin, to skip runing test add -Dmaven.test.skip -->
<!-- Unit tests plugin, to skip running test add -Dmaven.test.skip -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Xmx1024m ${surefireArgLine}</argLine><!-- Last argument is required for code coverage to work. -->
<runOrder>alphabetical</runOrder>
<systemProperties>
<property>
<name>java.util.logging.config.file</name>
<value>src/test/resources/logging.properties</value>
</property>
</systemProperties>
</configuration>
</plugin>

<!-- integration tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<runOrder>alphabetical</runOrder>
<argLine>${failsafeArgLine}</argLine>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>

<!-- Coveralls is a online code coverage tool, you can track code coverage here: https://coveralls.io/r/bitcoinj/bitcoinj -->
<plugin>
<groupId>org.eluder.coveralls</groupId>
Expand All @@ -341,39 +382,6 @@
</build>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<version>3.2</version>
<scope>test</scope>
</dependency>
<!-- bitcoinj consumers are expected to provide their own SLF4J adapters
such as logback, slf4j-log4j12, slf4j-jcl and so on
see http://www.slf4j.org/faq.html -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.7.20</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.5.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.167</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.madgag.spongycastle</groupId>
<artifactId>core</artifactId>
Expand Down Expand Up @@ -404,17 +412,35 @@
<artifactId>scrypt</artifactId>
<version>1.4.0</version>
</dependency>
<!-- Note this is an optional dependency: Postgres blockstore -->
<!-- To Test remove optional -->
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-901.jdbc4</version>
<optional>true</optional>
<groupId>org.bitcoinj</groupId>
<artifactId>orchid</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp</groupId>
<artifactId>okhttp</artifactId>
<version>2.7.2</version>
</dependency>

<!-- optional dependencies -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.167</version>
<optional>true</optional>
</dependency>
<dependency>
<!-- Note this is an optional dependency: Postgres blockstore -->
<!-- To Test remove optional -->
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-901.jdbc4</version>
<optional>true</optional>
</dependency>
<!-- Note this is an optional dependency: MySQL blockstore -->
<!-- To Test remove optional -->
<dependency>
<!-- Note this is an optional dependency: MySQL blockstore -->
<!-- To Test remove optional -->
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.33</version>
Expand All @@ -426,16 +452,31 @@
<version>1.8</version>
<optional>true</optional>
</dependency>

<!-- test dependencies -->
<dependency>
<groupId>org.bitcoinj</groupId>
<artifactId>orchid</artifactId>
<version>1.2.1</version>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.squareup.okhttp</groupId>
<artifactId>okhttp</artifactId>
<version>2.7.2</version>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<version>3.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.5.2</version>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@
* We don't do any wallet tests here, we leave that to {@link ChainSplitTest}
*/

public abstract class AbstractFullPrunedBlockChainTest {
public abstract class AbstractFullPrunedBlockChainIT {
@org.junit.Rule
public ExpectedException thrown = ExpectedException.none();

private static final Logger log = LoggerFactory.getLogger(AbstractFullPrunedBlockChainTest.class);
private static final Logger log = LoggerFactory.getLogger(AbstractFullPrunedBlockChainIT.class);

protected static final NetworkParameters PARAMS = new UnitTestParams() {
@Override public int getInterval() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public RuleList(List<Rule> list, Map<Sha256Hash, Block> hashHeaderMap, int maxim
}

public class FullBlockTestGenerator {
// Used by BitcoindComparisonTool and AbstractFullPrunedBlockChainTest to create test cases
// Used by BitcoindComparisonTool and AbstractFullPrunedBlockChainIT to create test cases
private NetworkParameters params;
private ECKey coinbaseOutKey;
private byte[] coinbaseOutKeyPubKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
/**
* An H2 implementation of the FullPrunedBlockStoreTest
*/
public class H2FullPrunedBlockChainTest extends AbstractFullPrunedBlockChainTest {
public class H2FullPrunedBlockChainIT extends AbstractFullPrunedBlockChainIT {
@After
public void tearDown() throws Exception {
deleteFiles();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
/**
* An H2 implementation of the FullPrunedBlockStoreTest
*/
public class LevelDBFullPrunedBlockChainTest extends
AbstractFullPrunedBlockChainTest {
public class LevelDBFullPrunedBlockChainIT extends
AbstractFullPrunedBlockChainIT {
@After
public void tearDown() throws Exception {
deleteFiles();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/**
* A MemoryStore implementation of the FullPrunedBlockStoreTest
*/
public class MemoryFullPrunedBlockChainTest extends AbstractFullPrunedBlockChainTest
public class MemoryFullPrunedBlockChainIT extends AbstractFullPrunedBlockChainIT
{
@Override
public FullPrunedBlockStore createStore(NetworkParameters params, int blockCount) throws BlockStoreException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
import org.bitcoinj.store.MySQLFullPrunedBlockStore;
import org.junit.After;
import org.junit.Ignore;
import org.junit.Test;

/**
* A MySQL implementation of the {@link AbstractFullPrunedBlockChainTest}
* A MySQL implementation of the {@link AbstractFullPrunedBlockChainIT}
*/
@Ignore("enable the mysql driver dependency in the maven POM")
public class MySQLFullPrunedBlockChainTest extends AbstractFullPrunedBlockChainTest {
public class MySQLFullPrunedBlockChainIT extends AbstractFullPrunedBlockChainIT {

@After
public void tearDown() throws Exception {
Expand All @@ -49,4 +49,11 @@ public FullPrunedBlockStore createStore(NetworkParameters params, int blockCount
public void resetStore(FullPrunedBlockStore store) throws BlockStoreException {
((MySQLFullPrunedBlockStore)store).resetStore();
}

@Override
@Test
@Ignore("causes error on travis MySQL - redo log not big enough")
// The size of BLOB/TEXT data inserted in one transaction is greater than 10% of redo log size. Increase the redo log size using innodb_log_file_size.
public void testGeneratedChain() {
}
}
Loading