Skip to content

Commit 0a5eca2

Browse files
committed
chore: fixup dockerfile and docker-compose
1 parent 038d37e commit 0a5eca2

1 file changed

Lines changed: 80 additions & 0 deletions

File tree

gradle/tasks/api-test.gradle

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
tasks.register('api', Test) {
2+
description = "Runs api tests against docker-compose stack"
3+
group = "Verification"
4+
5+
mustRunAfter tasks.named('test')
6+
7+
testClassesDirs = sourceSets.apiTest.output.classesDirs
8+
classpath = sourceSets.apiTest.runtimeClasspath
9+
useJUnitPlatform()
10+
11+
dependsOn tasks.composeUp
12+
finalizedBy tasks.composeDown
13+
14+
jvmArgs = ['-Xshare:off']
15+
testLogging {
16+
events "passed", "skipped", "failed"
17+
exceptionFormat = 'full'
18+
showStandardStreams = true
19+
}
20+
}
21+
22+
tasks.named('check') {
23+
dependsOn tasks.named('api')
24+
}
25+
26+
tasks.named('build') {
27+
dependsOn tasks.named('test')
28+
dependsOn tasks.named('api')
29+
}
30+
31+
sourceSets {
32+
apiTest {
33+
java {
34+
compileClasspath += sourceSets.main.output
35+
runtimeClasspath += sourceSets.main.output
36+
37+
}
38+
resources.srcDir file('src/apiTest/resources')
39+
}
40+
}
41+
42+
configurations {
43+
apiTestImplementation.extendsFrom testImplementation
44+
apiTestRuntimeOnly.extendsFrom testRuntimeOnly
45+
46+
// Ensure testRuntimeClasspath can be resolved for agent injection
47+
testRuntimeClasspath {
48+
canBeResolved = true
49+
}
50+
}
51+
52+
dependencies {
53+
apiTestImplementation platform('org.junit:junit-bom:5.13.4')
54+
apiTestRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
55+
56+
apiTestImplementation('org.springframework.boot:spring-boot-starter-test') {
57+
exclude group: 'junit', module: 'junit'
58+
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
59+
}
60+
apiTestRuntimeOnly 'org.junit.platform:junit-platform-launcher'
61+
apiTestCompileOnly group: 'org.projectlombok', name: 'lombok', version: lombokVersion
62+
apiTestAnnotationProcessor group: 'org.projectlombok', name: 'lombok', version: lombokVersion
63+
}
64+
65+
dockerCompose {
66+
useComposeFiles = ['docker/docker-compose.yml']
67+
startedServices = ['app', 'db']
68+
69+
buildBeforeUp = true
70+
waitForTcpPorts = true
71+
upAdditionalArgs = ['--wait', '--wait-timeout', '120']
72+
73+
captureContainersOutput = true
74+
removeOrphans = true
75+
stopContainers = true
76+
removeContainers = true
77+
78+
useDockerComposeV2 = true
79+
dockerExecutable = 'docker'
80+
}

0 commit comments

Comments
 (0)