Skip to content

Commit f9db043

Browse files
authored
Update test pipeline in CI (#112)
Add integration test profile Run ce and ee tests in parallel Add jacoco coverage report Closes #110
1 parent 62447b2 commit f9db043

12 files changed

+221
-83
lines changed

.github/workflows/tests.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# This workflow will build a Java project with Maven
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
3+
4+
name: Tests
5+
6+
on:
7+
push:
8+
branches: [ master ]
9+
pull_request:
10+
branches: [ master ]
11+
12+
jobs:
13+
tests-ce:
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 25
16+
strategy:
17+
fail-fast: false
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Set up JDK 1.8
22+
uses: actions/setup-java@v3
23+
with:
24+
distribution: 'zulu'
25+
java-version: '8'
26+
cache: 'maven'
27+
28+
- name: Build and run unit tests
29+
run: ./mvnw -B verify -Djacoco.destFile=target/jacoco-ce.exec --file pom.xml
30+
31+
- name: Run integration tests
32+
env:
33+
TARANTOOL_SERVER_USER: root
34+
TARANTOOL_SERVER_GROUP: root
35+
run: ./mvnw -B test -P integration -Djacoco.destFile=target/jacoco-ce.exec --file pom.xml
36+
37+
- name: Upload jacoco exec results
38+
uses: actions/upload-artifact@v2
39+
with:
40+
name: tests-ce-jacoco
41+
path: "**/jacoco-ce.exec"
42+
43+
tests-ee:
44+
runs-on: ubuntu-latest
45+
timeout-minutes: 20
46+
steps:
47+
- uses: actions/checkout@v4
48+
49+
- name: Set up JDK 1.8
50+
uses: actions/setup-java@v3
51+
with:
52+
distribution: 'zulu'
53+
java-version: '8'
54+
cache: 'maven'
55+
56+
- name: Run enterprise tests
57+
env:
58+
TARANTOOL_SERVER_USER: root
59+
TARANTOOL_SERVER_GROUP: root
60+
DOWNLOAD_HOST: https://tarantool:${{ secrets.DOWNLOAD_SDK_TOKEN }}@download.tarantool.io
61+
SDK_PATH: enterprise/release/linux/x86_64/2.11/tarantool-enterprise-sdk-nogc64-2.11.2-0-r609.linux.x86_64.tar.gz
62+
run: ./mvnw -B test -P enterprise -Djacoco.destFile=target/jacoco-ee.exec --file pom.xml
63+
64+
- name: Upload jacoco exec results
65+
uses: actions/upload-artifact@v2
66+
with:
67+
name: tests-ee-jacoco
68+
path: "**/jacoco-ee.exec"
69+
70+
merge-jacoco-report:
71+
name: Jacoco Merge Results
72+
needs:
73+
- tests-ce
74+
- tests-ee
75+
runs-on: ubuntu-latest
76+
steps:
77+
- uses: actions/checkout@v4
78+
79+
- name: Set up JDK 1.8
80+
uses: actions/setup-java@v3
81+
with:
82+
distribution: 'zulu'
83+
java-version: '8'
84+
cache: 'maven'
85+
86+
- uses: actions/download-artifact@v2
87+
with:
88+
name: tests-ce-jacoco
89+
path: .
90+
91+
- uses: actions/download-artifact@v2
92+
with:
93+
name: tests-ee-jacoco
94+
path: .
95+
96+
- name: merge results
97+
run: |
98+
./mvnw package jacoco:merge jacoco:report -DskipTests -Darguments=-DskipTests
99+
100+
- name: Upload jacoco coverage despite the check result
101+
if: ${{ always() }}
102+
uses: actions/upload-artifact@v2
103+
with:
104+
name: coverage-results-report
105+
path: target/site/jacoco
106+
if-no-files-found: error
107+
108+
- name: Jacoco Report to PR
109+
id: jacoco
110+
uses: madrapps/[email protected]
111+
with:
112+
paths: target/site/jacoco/jacoco.xml
113+
token: ${{ secrets.GITHUB_TOKEN }}
114+
min-coverage-overall: 40
115+
min-coverage-changed-files: 60
116+
update-comment: true

.github/workflows/ubuntu-master.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

pom.xml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,73 @@
203203
<tagNameFormat>v@{project.version}</tagNameFormat>
204204
</configuration>
205205
</plugin>
206+
<plugin>
207+
<groupId>org.jacoco</groupId>
208+
<artifactId>jacoco-maven-plugin</artifactId>
209+
<version>0.8.11</version>
210+
<executions>
211+
<execution>
212+
<goals>
213+
<goal>prepare-agent</goal>
214+
</goals>
215+
<configuration>
216+
<append>true</append>
217+
</configuration>
218+
</execution>
219+
</executions>
220+
<configuration>
221+
<fileSets>
222+
<fileSet>
223+
<directory>${project.build.directory}</directory>
224+
<includes>
225+
<include>*.exec</include>
226+
</includes>
227+
</fileSet>
228+
</fileSets>
229+
</configuration>
230+
</plugin>
206231
</plugins>
207232
</build>
208233

209234
<profiles>
235+
<profile>
236+
<id>integration</id>
237+
<build>
238+
<plugins>
239+
<plugin>
240+
<groupId>org.apache.maven.plugins</groupId>
241+
<artifactId>maven-antrun-plugin</artifactId>
242+
<version>3.0.0</version>
243+
<executions>
244+
<execution>
245+
<id>process-test-classes</id>
246+
<phase>process-test-classes</phase>
247+
<goals>
248+
<goal>run</goal>
249+
</goals>
250+
</execution>
251+
</executions>
252+
</plugin>
253+
<plugin>
254+
<artifactId>maven-surefire-plugin</artifactId>
255+
<version>3.0.0-M5</version>
256+
<configuration>
257+
<includes>
258+
<include>**/*IT.java</include>
259+
</includes>
260+
<excludes>
261+
<exclude>**/*EnterpriseIT.java</exclude>
262+
</excludes>
263+
<systemPropertyVariables>
264+
<logback.configurationFile>${logging.config}</logback.configurationFile>
265+
<logLevel>${logging.logLevel}</logLevel>
266+
</systemPropertyVariables>
267+
<trimStackTrace>false</trimStackTrace>
268+
</configuration>
269+
</plugin>
270+
</plugins>
271+
</build>
272+
</profile>
210273
<profile>
211274
<id>enterprise</id>
212275
<build>
@@ -218,6 +281,7 @@
218281
<configuration>
219282
<includes>
220283
<include>**/*TestEnterprise.java</include>
284+
<include>**/*EnterpriseIT.java</include>
221285
</includes>
222286
<systemPropertyVariables>
223287
<logback.configurationFile>${logging.config}</logback.configurationFile>
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* @author Alexey Kuzin
2424
*/
2525
@Testcontainers
26-
public class TarantoolCartridgeBootstrapFromLuaWithFixedPortsTest {
26+
public class TarantoolCartridgeBootstrapFromLuaWithFixedPortsIT {
2727

2828
@Container
2929
private static final TarantoolCartridgeContainer container =
@@ -38,7 +38,7 @@ public class TarantoolCartridgeBootstrapFromLuaWithFixedPortsTest {
3838
.withAPIPort(18081)
3939
.withRouterPort(13301)
4040
.withLogConsumer(new Slf4jLogConsumer(
41-
LoggerFactory.getLogger(TarantoolCartridgeBootstrapFromLuaWithFixedPortsTest.class)));
41+
LoggerFactory.getLogger(TarantoolCartridgeBootstrapFromLuaWithFixedPortsIT.class)));
4242

4343
@Test
4444
public void test_StaticClusterContainer_StartsSuccessfully_ifFilesAreCopied() throws Exception {
@@ -66,7 +66,7 @@ public void testTarantoolClusterCookieWithEnv() throws Exception {
6666
.withRouterPassword("secret")
6767
.withStartupTimeout(Duration.ofMinutes(5))
6868
.withLogConsumer(new Slf4jLogConsumer(
69-
LoggerFactory.getLogger(TarantoolCartridgeBootstrapFromYamlTest.class))))
69+
LoggerFactory.getLogger(TarantoolCartridgeBootstrapFromYamlIT.class))))
7070
{
7171
newContainer.start();
7272
ExecResult res = newContainer.execInContainer("env");
@@ -91,7 +91,7 @@ public void test_retryingSetupTopology_shouldWork() {
9191
"cartridge/incorrect_topology.lua")
9292
.withLogConsumer(new Slf4jLogConsumer(
9393
LoggerFactory.getLogger(
94-
TarantoolCartridgeBootstrapFromLuaWithFixedPortsTest.class)))
94+
TarantoolCartridgeBootstrapFromLuaWithFixedPortsIT.class)))
9595
.withStartupTimeout(Duration.ofMinutes(5))) {
9696
ContainerLaunchException ex = assertThrows(ContainerLaunchException.class, testContainer::start);
9797
Throwable cause = ex.getCause();
@@ -126,7 +126,7 @@ public void testBuildArgs() throws Exception {
126126
buildArgs)
127127
.withStartupTimeout(Duration.ofMinutes(5))
128128
.withLogConsumer(new Slf4jLogConsumer(
129-
LoggerFactory.getLogger(TarantoolCartridgeBootstrapFromYamlTest.class)))
129+
LoggerFactory.getLogger(TarantoolCartridgeBootstrapFromYamlIT.class)))
130130
) {
131131
newContainer.start();
132132
ExecResult res = newContainer.execInContainer("env");

src/test/java/org/testcontainers/containers/TarantoolCartridgeBootstrapFromYamlTest.java renamed to src/test/java/org/testcontainers/containers/TarantoolCartridgeBootstrapFromYamlIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* @author Ivan Dneprov
1717
*/
1818
@Testcontainers
19-
public class TarantoolCartridgeBootstrapFromYamlTest {
19+
public class TarantoolCartridgeBootstrapFromYamlIT {
2020

2121
@Container
2222
private static final TarantoolCartridgeContainer container =
@@ -27,7 +27,7 @@ public class TarantoolCartridgeBootstrapFromYamlTest {
2727
"cartridge/replicasets.yml")
2828
.withStartupTimeout(Duration.ofMinutes(5))
2929
.withLogConsumer(new Slf4jLogConsumer(
30-
LoggerFactory.getLogger(TarantoolCartridgeBootstrapFromYamlTest.class)));
30+
LoggerFactory.getLogger(TarantoolCartridgeBootstrapFromYamlIT.class)));
3131

3232
@Test
3333
public void test_StaticClusterContainer_StartsSuccessfully_ifFilesAreCopied() throws Exception {

src/test/java/org/testcontainers/containers/TarantoolCartridgePortMappingTest.java renamed to src/test/java/org/testcontainers/containers/TarantoolCartridgePortMappingIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import static org.junit.jupiter.api.Assertions.assertFalse;
2222
import static org.junit.jupiter.api.Assertions.assertTrue;
2323

24-
public class TarantoolCartridgePortMappingTest {
24+
public class TarantoolCartridgePortMappingIT {
2525

2626
@Container
2727
private final static TarantoolCartridgeContainer container = new TarantoolCartridgeContainer(
@@ -34,7 +34,7 @@ public class TarantoolCartridgePortMappingTest {
3434
.withRouterPassword("secret")
3535
.withStartupTimeout(Duration.ofMinutes(5))
3636
.withLogConsumer(new Slf4jLogConsumer(
37-
LoggerFactory.getLogger(TarantoolCartridgeBootstrapFromYamlTest.class)));
37+
LoggerFactory.getLogger(TarantoolCartridgeBootstrapFromYamlIT.class)));
3838

3939
@Test
4040
void portMappingTest() throws IOException, URISyntaxException {

src/test/java/org/testcontainers/containers/TarantoolContainerTest.java renamed to src/test/java/org/testcontainers/containers/TarantoolContainerIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* @author Alexey Kuzin
1313
* @author Ivan Dneprov
1414
*/
15-
class TarantoolContainerTest {
15+
class TarantoolContainerIT {
1616

1717
private static final String ENV_TARANTOOL_VERSION = "TARANTOOL_VERSION";
1818

src/test/java/org/testcontainers/containers/TarantoolStaticContainerTest.java renamed to src/test/java/org/testcontainers/containers/TarantoolStaticContainerIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* @author Ivan Dneprov
1414
*/
1515
@Testcontainers
16-
public class TarantoolStaticContainerTest {
16+
public class TarantoolStaticContainerIT {
1717

1818
@Container
1919
private static final TarantoolContainer container = new TarantoolContainer();

src/test/java/org/testcontainers/containers/enterprise/TarantoolMTlsContainerTestEnterprise.java renamed to src/test/java/org/testcontainers/containers/enterprise/TarantoolMTlsContainerEnterpriseIT.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,21 @@
1818
/**
1919
* @author Ivan Dneprov
2020
*/
21-
public class TarantoolMTlsContainerTestEnterprise {
21+
public class TarantoolMTlsContainerEnterpriseIT {
2222

23-
private static final Logger log = LoggerFactory.getLogger(TarantoolMTlsContainerTestEnterprise.class);
23+
private static final Logger log = LoggerFactory.getLogger(TarantoolMTlsContainerEnterpriseIT.class);
2424

2525
private static TarantoolContainer containerWithSsl;
2626

2727
@BeforeAll
2828
public static void setUp() throws Exception {
2929
final File dockerfile = new File(
30-
TarantoolMTlsContainerTestEnterprise.class.getClassLoader()
30+
TarantoolMTlsContainerEnterpriseIT.class.getClassLoader()
3131
.getResource("enterprise/Dockerfile").toURI()
3232
);
3333
final Map<String, String> buildArgs = new HashMap<>();
34-
buildArgs.put("DOWNLOAD_SDK_URI", System.getenv("DOWNLOAD_SDK_URI"));
35-
buildArgs.put("SDK_VERSION", System.getenv("SDK_VERSION"));
34+
buildArgs.put("DOWNLOAD_HOST", System.getenv("DOWNLOAD_HOST"));
35+
buildArgs.put("SDK_PATH", System.getenv("SDK_PATH"));
3636

3737
containerWithSsl = new TarantoolContainer(
3838
new TarantoolImageParams("tarantool-enterprise", dockerfile, buildArgs))

src/test/java/org/testcontainers/containers/enterprise/TarantoolSdkContainerTestEnterprise.java renamed to src/test/java/org/testcontainers/containers/enterprise/TarantoolSdkContainerEnterpriseIT.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@
1414
* @author Oleg Kuznetsov
1515
* @author Ivan Dneprov
1616
*/
17-
public class TarantoolSdkContainerTestEnterprise {
17+
public class TarantoolSdkContainerEnterpriseIT {
1818

1919

2020
@Test
2121
void test_should_createTarantoolContainerFromSdk() throws Exception {
2222
final File dockerfile = new File(
23-
TarantoolSdkContainerTestEnterprise.class.getClassLoader().getResource("enterprise/Dockerfile").toURI()
23+
TarantoolSdkContainerEnterpriseIT.class.getClassLoader().getResource("enterprise/Dockerfile").toURI()
2424
);
2525
final Map<String, String> buildArgs = new HashMap<>();
26-
buildArgs.put("DOWNLOAD_SDK_URI", System.getenv("DOWNLOAD_SDK_URI"));
27-
buildArgs.put("SDK_VERSION", System.getenv("SDK_VERSION"));
26+
buildArgs.put("DOWNLOAD_HOST", System.getenv("DOWNLOAD_HOST"));
27+
buildArgs.put("SDK_PATH", System.getenv("SDK_PATH"));
2828

2929
try (final TarantoolContainer tarantoolContainer = new TarantoolContainer(
3030
new TarantoolImageParams("tarantool-enterprise-bundle:latest", dockerfile, buildArgs))
@@ -33,10 +33,8 @@ void test_should_createTarantoolContainerFromSdk() throws Exception {
3333
tarantoolContainer.start();
3434

3535
List<String> result = tarantoolContainer.executeCommandDecoded("return 'test'");
36-
List<String> versionAnswer = tarantoolContainer.executeCommandDecoded("return _TARANTOOL");
3736

3837
Assertions.assertEquals("test", result.get(0));
39-
Assertions.assertEquals("2.10.7-0-g2e9b20365-r563-nogc64", versionAnswer.get(0));
4038
}
4139
}
4240
}

0 commit comments

Comments
 (0)