Skip to content

Commit 0f24164

Browse files
authored
Merge pull request #5 from xdev-software/develop
Release
2 parents 80ca591 + c1e2676 commit 0f24164

File tree

179 files changed

+33754
-159
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+33754
-159
lines changed

.github/workflows/checkBuild.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ on:
2121

2222
env:
2323
PRIMARY_MAVEN_MODULE: ${{ github.event.repository.name }}
24-
DEMO_MAVEN_MODULE: ${{ github.event.repository.name }}-demo
2524

2625
jobs:
2726
build:
@@ -43,7 +42,7 @@ jobs:
4342
cache: 'maven'
4443

4544
- name: Build with Maven
46-
run: ./mvnw -B clean package
45+
run: ./mvnw -B clean package -P ignore-service-loading
4746

4847
- name: Check for uncommited changes
4948
run: |
@@ -63,13 +62,6 @@ jobs:
6362
exit 1
6463
fi
6564
66-
- name: Upload demo files
67-
uses: actions/upload-artifact@v4
68-
with:
69-
name: demo-files-java-${{ matrix.java }}
70-
path: ${{ env.DEMO_MAVEN_MODULE }}/target/${{ env.DEMO_MAVEN_MODULE }}.jar
71-
if-no-files-found: error
72-
7365
code-style:
7466
runs-on: ubuntu-latest
7567
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
cache: 'maven'
2626

2727
- name: Build with Maven
28-
run: ./mvnw -B clean package
28+
run: ./mvnw -B clean package -P ignore-service-loading
2929

3030
- name: Check for uncommited changes
3131
run: |
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Run integration tests
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ develop ]
7+
paths-ignore:
8+
- '**.md'
9+
- '.config/**'
10+
- '.github/**'
11+
- '.idea/**'
12+
- 'assets/**'
13+
pull_request:
14+
branches: [ develop ]
15+
paths-ignore:
16+
- '**.md'
17+
- '.config/**'
18+
- '.github/**'
19+
- '.idea/**'
20+
- 'assets/**'
21+
22+
concurrency:
23+
group: ${{ github.workflow }}-${{ github.ref }}
24+
25+
jobs:
26+
run-integration-tests:
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
java: [17, 21]
31+
project: [persistence-it, webapp-it]
32+
parallel: [0, 2]
33+
pre-start: [false, true]
34+
runs-on: ubuntu-latest
35+
steps:
36+
- uses: actions/checkout@v4
37+
38+
- name: Set up JDK
39+
uses: actions/setup-java@v4
40+
with:
41+
distribution: temurin
42+
java-version: ${{ matrix.java }}
43+
cache: 'maven'
44+
45+
- name: Test
46+
run: |
47+
./mvnw -B test \
48+
-pl "tci-advanced-demo/${{ matrix.project }}" -am \
49+
-P run-it \
50+
${{ matrix.pre-start && '-Dinfra-pre-start.enabled=1 ' || '' }} \
51+
${{ matrix.parallel > 0 && format('-Djunit.jupiter.execution.parallel.enabled=true -Djunit.jupiter.execution.parallel.mode.default=concurrent -Djunit.jupiter.execution.parallel.mode.classes.default=concurrent -Djunit.jupiter.execution.parallel.config.strategy=fixed -Djunit.jupiter.execution.parallel.config.fixed.parallelism=2 -Djunit.jupiter.execution.parallel.config.fixed.max-pool-size={0} ', matrix.parallel) || '' }}
52+
53+
# Replace '/' with '-'
54+
- name: Normalize project name
55+
if: failure()
56+
env:
57+
PROJECT: ${{ matrix.project }}
58+
run: echo PROJECT_NORMALIZED=${PROJECT/\//-} >> $GITHUB_ENV
59+
60+
- name: Upload videos of test failures
61+
if: failure()
62+
uses: actions/upload-artifact@v4
63+
with:
64+
name: test-fail-videos-${{ matrix.java }}-${{ env.PROJECT_NORMALIZED }}-${{ matrix.parallel }}-${{ matrix.pre-start }}
65+
path: ${{ matrix.project }}/target/records
66+
if-no-files-found: ignore

.run/All in persistence-it.run.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="All in persistence-it" type="JUnit" factoryName="JUnit" nameIsGenerated="true">
3+
<module name="persistence-it" />
4+
<option name="PACKAGE_NAME" value="" />
5+
<option name="MAIN_CLASS_NAME" value="" />
6+
<option name="METHOD_NAME" value="" />
7+
<option name="TEST_OBJECT" value="package" />
8+
<method v="2">
9+
<option name="Make" enabled="true" />
10+
</method>
11+
</configuration>
12+
</component>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="All in webapp-it (p=2 + PreStart)" type="JUnit" factoryName="JUnit">
3+
<module name="webapp-it" />
4+
<option name="PACKAGE_NAME" value="" />
5+
<option name="MAIN_CLASS_NAME" value="" />
6+
<option name="METHOD_NAME" value="" />
7+
<option name="TEST_OBJECT" value="package" />
8+
<option name="VM_PARAMETERS" value="-ea -Dinfra-pre-start.enabled=1 -Djunit.jupiter.execution.parallel.enabled=true -Djunit.jupiter.execution.parallel.mode.default=concurrent -Djunit.jupiter.execution.parallel.mode.classes.default=concurrent -Djunit.jupiter.execution.parallel.config.strategy=fixed -Djunit.jupiter.execution.parallel.config.fixed.parallelism=2 -Djunit.jupiter.execution.parallel.config.fixed.max-pool-size=2" />
9+
<method v="2">
10+
<option name="Make" enabled="true" />
11+
</method>
12+
</configuration>
13+
</component>

.run/All in webapp-it (p=2).run.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="All in webapp-it (p=2)" type="JUnit" factoryName="JUnit">
3+
<module name="webapp-it" />
4+
<option name="PACKAGE_NAME" value="" />
5+
<option name="MAIN_CLASS_NAME" value="" />
6+
<option name="METHOD_NAME" value="" />
7+
<option name="TEST_OBJECT" value="package" />
8+
<option name="VM_PARAMETERS" value="-ea -Djunit.jupiter.execution.parallel.enabled=true -Djunit.jupiter.execution.parallel.mode.default=concurrent -Djunit.jupiter.execution.parallel.mode.classes.default=concurrent -Djunit.jupiter.execution.parallel.config.strategy=fixed -Djunit.jupiter.execution.parallel.config.fixed.parallelism=2 -Djunit.jupiter.execution.parallel.config.fixed.max-pool-size=2" />
9+
<method v="2">
10+
<option name="Make" enabled="true" />
11+
</method>
12+
</configuration>
13+
</component>

.run/All in webapp-it.run.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="All in webapp-it" type="JUnit" factoryName="JUnit" nameIsGenerated="true">
3+
<module name="webapp-it" />
4+
<option name="PACKAGE_NAME" value="" />
5+
<option name="MAIN_CLASS_NAME" value="" />
6+
<option name="METHOD_NAME" value="" />
7+
<option name="TEST_OBJECT" value="package" />
8+
<method v="2">
9+
<option name="Make" enabled="true" />
10+
</method>
11+
</configuration>
12+
</component>

.run/Demo Application.run.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="Demo Application" type="Application" factoryName="Application">
3+
<option name="MAIN_CLASS_NAME" value="software.xdev.tci.demo.Application" />
4+
<module name="webapp" />
5+
<method v="2">
6+
<option name="Make" enabled="true" />
7+
</method>
8+
</configuration>
9+
</component>

.run/Run Demo.run.xml

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

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# 1.0.0
2+
_Initial release_

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ You should have the following things installed:
3333
* Ensure that the JDK/Java-Version is correct
3434

3535

36-
## Releasing [![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/template-placeholder/release.yml?branch=master)](https://github.com/xdev-software/template-placeholder/actions/workflows/release.yml)
36+
## Releasing [![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/tci-base/release.yml?branch=master)](https://github.com/xdev-software/tci-base/actions/workflows/release.yml)
3737

3838
Before releasing:
39-
* Consider doing a [test-deployment](https://github.com/xdev-software/template-placeholder/actions/workflows/test-deploy.yml?query=branch%3Adevelop) before actually releasing.
39+
* Consider doing a [test-deployment](https://github.com/xdev-software/tci-base/actions/workflows/test-deploy.yml?query=branch%3Adevelop) before actually releasing.
4040
* Check the [changelog](CHANGELOG.md)
4141

4242
If the ``develop`` is ready for release, create a pull request to the ``master``-Branch and merge the changes

PERFORMANCE.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Performance
2+
3+
## PreStarting Comparison
4+
_As of: 2024-05-03_
5+
6+
> [!NOTE]
7+
> PreStarting performance is highly situational.<br/>
8+
> Checkout the JavaDocs for more information.
9+
10+
### Initial situation
11+
12+
* Running the demo webapp integration tests
13+
* Parallelization (tests executed in parallel) is 2
14+
* Launched using the launch files in the demo
15+
16+
#### Environment
17+
* Windows + Docker Desktop
18+
* Ryzen 3700X 8C/16T @3.6GHz
19+
* 32GB available RAM for Docker
20+
21+
### Results
22+
23+
| | Without PreStarting | With PreStarting |
24+
| --- | --- | --- |
25+
| Total duration | 3m 22s | 2m 34s |
26+
| Average duration per test | 25s | 20s |
27+
| PreStarting Utilization<br/>(how often was PreStarted infrastructure used instead of directly booting it) | - | >90% |
28+
| Avg. time to get basic infra (db, oidc, app) | 10s | 9s |
29+
| Avg. time to get Selenium/WebDriver | 7s | 1s |
30+
| Resource utilization | ![graphic](./assets/PERF-WEBAPP-DEMO_P2.png) | ![graphic](./assets/PERF-WEBAPP-DEMO_P2_PRESTART.png) |
31+
32+
## Live
33+
34+
A live comparison using [GitHub actions is also available](https://github.com/xdev-software/tci-base/actions/workflows/run-integration-tests.yml).

README.md

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,29 @@
1-
[![Latest version](https://img.shields.io/maven-central/v/software.xdev/template-placeholder?logo=apache%20maven)](https://mvnrepository.com/artifact/software.xdev/template-placeholder)
2-
[![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/template-placeholder/checkBuild.yml?branch=develop)](https://github.com/xdev-software/template-placeholder/actions/workflows/checkBuild.yml?query=branch%3Adevelop)
3-
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=xdev-software_template-placeholder&metric=alert_status)](https://sonarcloud.io/dashboard?id=xdev-software_template-placeholder)
1+
[![Latest version](https://img.shields.io/maven-central/v/software.xdev/tci-base?logo=apache%20maven)](https://mvnrepository.com/artifact/software.xdev/tci-base)
2+
[![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/tci-base/checkBuild.yml?branch=develop)](https://github.com/xdev-software/tci-base/actions/workflows/checkBuild.yml?query=branch%3Adevelop)
3+
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=xdev-software_tci-base&metric=alert_status)](https://sonarcloud.io/dashboard?id=xdev-software_tci-base)
44

5-
# template-placeholder
5+
# <img src="./assets/logo.png" height=28 > Testcontainers Infrastructure (TCI) Framework Base
66

7+
Basis Module for XDEV's Testcontainer Infrastructure Framework
8+
9+
## Features
10+
* Easily create infrastructure using - TCI (TestContainer Infrastructure) templating + Factories for that
11+
* [PreStarting mechanism](./tci-base/src/main/java/software/xdev/tci/factory/prestart/) for [additional performance](./PERFORMANCE.md)
12+
* An optimized [implementation of Network](./tci-base/src/main/java/software/xdev/tci/network/)
13+
* [Safe starting of named containers](./tci-base/src/main/java/software/xdev/tci/safestart/)
14+
* [Container Leak detection](./tci-base/src/main/java/software/xdev/tci/leakdetection/)
15+
* [Tracing](./tci-base/src/main/java/software/xdev/tci/tracing/)
16+
17+
## Usage
18+
This module has many different components that can be used in different situations in different ways.
19+
20+
Checkout the [advanced demo](./tci-advanced-demo/) as a reference to get a feeling how this can be done.
21+
22+
> [!TIP]
23+
> More detailed documentation is usually available in the corresponding JavaDocs.
724
825
## Installation
9-
[Installation guide for the latest release](https://github.com/xdev-software/template-placeholder/releases/latest#Installation)
26+
[Installation guide for the latest release](https://github.com/xdev-software/tci-base/releases/latest#Installation)
1027

1128
## Support
1229
If you need support as soon as possible and you can't wait for any pull request, feel free to use [our support](https://xdev.software/en/services/support).
@@ -15,4 +32,4 @@ If you need support as soon as possible and you can't wait for any pull request,
1532
See the [contributing guide](./CONTRIBUTING.md) for detailed instructions on how to get started with our project.
1633

1734
## Dependencies and Licenses
18-
View the [license of the current project](LICENSE) or the [summary including all dependencies](https://xdev-software.github.io/template-placeholder/dependencies)
35+
View the [license of the current project](LICENSE) or the [summary including all dependencies](https://xdev-software.github.io/tci-base/dependencies)

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
## Reporting a Vulnerability
44

5-
Please report a security vulnerability [on GitHub Security Advisories](https://github.com/xdev-software/template-placeholder/security/advisories/new).
5+
Please report a security vulnerability [on GitHub Security Advisories](https://github.com/xdev-software/tci-base/security/advisories/new).

assets/PERF-WEBAPP-DEMO_P2.png

46.2 KB
Loading
51.7 KB
Loading

assets/logo.png

27.4 KB
Loading

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<modelVersion>4.0.0</modelVersion>
66

77
<groupId>software.xdev</groupId>
8-
<artifactId>template-placeholder-root</artifactId>
8+
<artifactId>tci-base-root</artifactId>
99
<version>1.0.0-SNAPSHOT</version>
1010
<packaging>pom</packaging>
1111

@@ -15,8 +15,8 @@
1515
</organization>
1616

1717
<modules>
18-
<module>template-placeholder</module>
19-
<module>template-placeholder-demo</module>
18+
<module>tci-base</module>
19+
<module>tci-advanced-demo</module>
2020
</modules>
2121

2222
<licenses>

renovate.json5

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,30 @@
11
{
22
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3-
"rebaseWhen": "behind-base-branch"
4-
}
3+
"rebaseWhen": "behind-base-branch",
4+
"packageRules": [
5+
{
6+
"description": "Ignore dependencies for JDK8",
7+
"packagePattern": "^org.bsc.maven:maven-processor-plugin",
8+
"datasources": [
9+
"maven"
10+
],
11+
"allowedVersions": "!/jdk8$/"
12+
},
13+
{
14+
"description": "Java LTS 21",
15+
"packagePattern": "^eclipse-temurin",
16+
"datasources": [
17+
"docker"
18+
],
19+
"allowedVersions": "/^21\\-alpine$/"
20+
},
21+
{
22+
"description": "MariaDB 11 has no LTS and is experimental",
23+
"packagePattern": "^mariadb",
24+
"datasources": [
25+
"docker"
26+
],
27+
"allowedVersions": "<11"
28+
}
29+
]
30+
}

tci-advanced-demo/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Advanced TCI Demo
2+
3+
This demo is a reference implementation for TCI.
4+
5+
It represents a Spring Boot Application with a Database and OIDC authentication that is tested using Selenium.
6+
There are also test that validate the database migrations and queries.
7+
8+
The most interesting project is probably [webapp-it](./webapp-it/) which contains the integration tests for the WebApp.
9+
10+
> [!TIP]
11+
> Pre defined launchers exist for running the app and the integration tests.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
db.env
2+
oidc-user-config.json

0 commit comments

Comments
 (0)