Skip to content

Commit

Permalink
Setup CI targets for tarantool
Browse files Browse the repository at this point in the history
- Add new CI targets for the following TNT versions: 1.9, 1.10, 2x,
  and 2.2 against JDKs versions 8, 11, and 12.
- Add 'sql' test group in order to segregate SQL tests and be able to
  turn them off.
- Update testing tools versions in POM.
- Update 'Building' section of README file how to run test w\o SQL part.

Closes: tarantool#52, tarantool#143
  • Loading branch information
nicktorwald committed May 15, 2019
1 parent 0ee7b30 commit 8445221
Show file tree
Hide file tree
Showing 13 changed files with 97 additions and 23 deletions.
18 changes: 12 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,29 @@ language: java
sudo: required
dist: trusty

jdk:
- openjdk8
- openjdk11
- openjdk12

env:
- TNT_VERSION=1.9 EXCLUDE_GROUPS=sql
- TNT_VERSION=1.10 EXCLUDE_GROUPS=sql
- TNT_VERSION=2x EXCLUDE_GROUPS=
- TNT_VERSION=2.2 EXCLUDE_GROUPS=

stages:
- checkstyle
- test

jobs:
include:
- stage: checkstyle
env: []
jdk: openjdk11
before_script: skip
script: mvn checkstyle:check
after_success: skip
- stage: test
jdk: openjdk8
- stage: test
jdk: openjdk11
- stage: test
jdk: openjdk12

before_script:
- .travis/travis.pre.sh
Expand Down
6 changes: 3 additions & 3 deletions .travis/travis.build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

set -exu # Strict shell (w/o -o pipefail)

if [ "${TRAVIS_JDK_VERSION}" = openjdk11 ]; then
mvn verify jacoco:report
if [ "${TRAVIS_JDK_VERSION}" = "openjdk11" ] && [ "${TNT_VERSION}" = "2x" ]; then
mvn -Dtest.groups.exclude=$EXCLUDE_GROUPS verify jacoco:report
else
mvn verify
mvn -Dtest.groups.exclude=$EXCLUDE_GROUPS verify
fi

head -n -0 testroot/*.log
2 changes: 1 addition & 1 deletion .travis/travis.post.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

set -exu # Strict shell (w/o -o pipefail)

if [ "${TRAVIS_JDK_VERSION}" = openjdk11 ]; then
if [ "${TRAVIS_JDK_VERSION}" = "openjdk11" ] && [ "${TNT_VERSION}" = "2x" ]; then
mvn coveralls:report -DrepoToken=${COVERALLS_TOKEN}
fi
11 changes: 5 additions & 6 deletions .travis/travis.pre.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

set -exuo pipefail # Strict shell

# We need tarantool 2.* for jdbc/sql.
curl http://download.tarantool.org/tarantool/2x/gpgkey | sudo apt-key add -
release=`lsb_release -c -s`
curl http://download.tarantool.org/tarantool/${TNT_VERSION}/gpgkey | sudo apt-key add -
RELEASE=`lsb_release -c -s`

sudo rm -f /etc/apt/sources.list.d/*tarantool*.list
sudo tee /etc/apt/sources.list.d/tarantool_2x.list <<- EOF
deb http://download.tarantool.org/tarantool/2x/ubuntu/ $release main
deb-src http://download.tarantool.org/tarantool/2x/ubuntu/ $release main
sudo tee /etc/apt/sources.list.d/tarantool_${TNT_VERSION/./_}.list <<- EOF
deb http://download.tarantool.org/tarantool/${TNT_VERSION}/ubuntu/ ${RELEASE} main
deb-src http://download.tarantool.org/tarantool/${TNT_VERSION}/ubuntu/ ${RELEASE} main
EOF

sudo apt-get update
Expand Down
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,24 @@ base for possible answers and solutions.
## Building
To run tests
To run unit and integration tests you can use full test suite:
```bash
./mvnw clean verify
```
There is a separate test group called `sql` which consists of
SQL-only tests and can be excluded from the common test suite
(that may be convenient if you run tests using Tarantool version 1.x
as a target DB where SQL isn't supported):
```bash
./mvnw -Dtest.groups.exclude=sql clean verify
```
./mvnw clean test
It's also possible run only SQL tests:
```bash
./mvnw -Dtest.groups.include=sql clean verify
```
20 changes: 15 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
<version>1.9.2-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<test.groups.include/>
<test.groups.exclude/>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<junit.jupiter.version>5.3.1</junit.jupiter.version>
<junit.jupiter.version>5.4.2</junit.jupiter.version>
<snakeyml.version>1.23</snakeyml.version>
<mockito.version>1.10.19</mockito.version>
</properties>
<name>Tarantool Connector for Java</name>
<url>https://github.com/tarantool/tarantool-java</url>
Expand Down Expand Up @@ -79,12 +83,16 @@
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<version>3.0.0-M3</version>
<configuration>
<groups>${test.groups.include}</groups>
<excludedGroups>${test.groups.exclude}</excludedGroups>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.0</version>
<version>3.0.0-M3</version>
<executions>
<execution>
<goals>
Expand All @@ -95,6 +103,8 @@
</executions>
<configuration>
<trimStackTrace>false</trimStackTrace>
<groups>${test.groups.include}</groups>
<excludedGroups>${test.groups.exclude}</excludedGroups>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -172,13 +182,13 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.23</version>
<version>${snakeyml.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.tarantool.TestUtils.makeInstanceEnv;

import org.tarantool.conf.SqlTestClass;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;

Expand All @@ -15,6 +17,7 @@
/**
* Abstract test. Provides environment control and frequently used functions which are related to SQL.
*/
@SqlTestClass
public abstract class AbstractTarantoolSQLConnectorIT {

protected static final String HOST = System.getProperty("tntHost", "localhost");
Expand Down
16 changes: 16 additions & 0 deletions src/test/java/org/tarantool/conf/SqlTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.tarantool.conf;

import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target({ ElementType.TYPE, ElementType.METHOD, ElementType.PACKAGE })
@Retention(RetentionPolicy.RUNTIME)
@Tag("sql")
@Test
public @interface SqlTest {
}
14 changes: 14 additions & 0 deletions src/test/java/org/tarantool/conf/SqlTestClass.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.tarantool.conf;

import org.junit.jupiter.api.Tag;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target({ ElementType.TYPE, ElementType.METHOD, ElementType.PACKAGE })
@Retention(RetentionPolicy.RUNTIME)
@Tag("sql")
public @interface SqlTestClass {
}
2 changes: 2 additions & 0 deletions src/test/java/org/tarantool/jdbc/AbstractJdbcIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import org.tarantool.TarantoolConnection;
import org.tarantool.TarantoolControl;
import org.tarantool.conf.SqlTestClass;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
Expand All @@ -23,6 +24,7 @@
import java.util.List;

//mvn -DtntHost=localhost -DtntPort=3301 -DtntUser=test -DtntPass=test verify
@SqlTestClass
public abstract class AbstractJdbcIT {
private static final String host = System.getProperty("tntHost", "localhost");
private static final Integer port = Integer.valueOf(System.getProperty("tntPort", "3301"));
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/org/tarantool/jdbc/JdbcDriverTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import static org.tarantool.jdbc.SQLDriver.PROP_USER;

import org.tarantool.CommunicationException;
import org.tarantool.conf.SqlTestClass;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.function.Executable;
Expand All @@ -30,6 +31,7 @@
import java.sql.SQLException;
import java.util.Properties;

@SqlTestClass
public class JdbcDriverTest {
@Test
public void testParseQueryString() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import org.tarantool.CommunicationException;
import org.tarantool.TarantoolConnection;
import org.tarantool.conf.SqlTestClass;
import org.tarantool.protocol.TarantoolPacket;

import org.junit.jupiter.api.Test;
Expand All @@ -40,6 +41,7 @@
import java.util.HashMap;
import java.util.Properties;

@SqlTestClass
public class JdbcExceptionHandlingTest {
/**
* Simulates meta parsing error: missing "name" field in a space format for the primary key.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;

import org.tarantool.conf.SqlTestClass;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

Expand All @@ -16,6 +18,7 @@
/**
* Minimal iterator use cases should be implemented by every {@link CursorIterator}.
*/
@SqlTestClass
public abstract class AbstractCursorIteratorTest {

protected abstract CursorIterator<List<Object>> getCursorIterator(List<List<Object>> result);
Expand Down

0 comments on commit 8445221

Please sign in to comment.