mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-07-05 00:56:58 +08:00
Update spring-boot-launch-script-tests to use docker-test plugin
See gh-41228
This commit is contained in:
parent
6564abb12a
commit
7e4d60e07f
|
@ -1,7 +1,7 @@
|
|||
plugins {
|
||||
id "java"
|
||||
id "org.springframework.boot.conventions"
|
||||
id "org.springframework.boot.integration-test"
|
||||
id "org.springframework.boot.docker-test"
|
||||
id "de.undercouch.download"
|
||||
}
|
||||
|
||||
|
@ -19,15 +19,15 @@ dependencies {
|
|||
app project(path: ":spring-boot-project:spring-boot-parent", configuration: "mavenRepository")
|
||||
app project(path: ":spring-boot-project:spring-boot-tools:spring-boot-gradle-plugin", configuration: "mavenRepository")
|
||||
|
||||
intTestImplementation(enforcedPlatform(project(":spring-boot-project:spring-boot-parent")))
|
||||
intTestImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
|
||||
intTestImplementation(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-test"))
|
||||
intTestImplementation("org.testcontainers:testcontainers")
|
||||
dockerTestImplementation(enforcedPlatform(project(":spring-boot-project:spring-boot-parent")))
|
||||
dockerTestImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
|
||||
dockerTestImplementation(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-test"))
|
||||
dockerTestImplementation("org.testcontainers:testcontainers")
|
||||
}
|
||||
|
||||
task syncMavenRepository(type: Sync) {
|
||||
from configurations.app
|
||||
into "${buildDir}/int-test-maven-repository"
|
||||
into "${buildDir}/docker-test-maven-repository"
|
||||
}
|
||||
|
||||
task syncAppSource(type: org.springframework.boot.build.SyncAppSource) {
|
||||
|
@ -59,10 +59,10 @@ task syncJdkDownloads(type: Sync) {
|
|||
into "${project.buildDir}/downloads/jdk/bellsoft/"
|
||||
}
|
||||
|
||||
processIntTestResources {
|
||||
tasks.named("processDockerTestResources").configure {
|
||||
dependsOn syncJdkDownloads
|
||||
}
|
||||
|
||||
intTest {
|
||||
tasks.named("dockerTest").configure {
|
||||
dependsOn buildApp
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ plugins {
|
|||
apply plugin: "io.spring.dependency-management"
|
||||
|
||||
repositories {
|
||||
maven { url "file:${rootDir}/../int-test-maven-repository"}
|
||||
maven { url "file:${rootDir}/../docker-test-maven-repository"}
|
||||
mavenCentral()
|
||||
maven { url "https://repo.spring.io/milestone" }
|
||||
maven { url "https://repo.spring.io/snapshot" }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
pluginManagement {
|
||||
repositories {
|
||||
maven { url "file:${rootDir}/../int-test-maven-repository"}
|
||||
maven { url "file:${rootDir}/../docker-test-maven-repository"}
|
||||
mavenCentral()
|
||||
maven { url "https://repo.spring.io/snapshot" }
|
||||
maven { url "https://repo.spring.io/milestone" }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -57,7 +57,7 @@ abstract class AbstractLaunchScriptIntegrationTests {
|
|||
|
||||
static List<Object[]> filterParameters(Predicate<File> osFilter) {
|
||||
List<Object[]> parameters = new ArrayList<>();
|
||||
for (File os : new File("src/intTest/resources/conf").listFiles()) {
|
||||
for (File os : new File("src/dockerTest/resources/conf").listFiles()) {
|
||||
if (osFilter.test(os)) {
|
||||
for (File version : os.listFiles()) {
|
||||
parameters.add(new Object[] { os.getName(), version.getName() });
|
||||
|
@ -103,10 +103,10 @@ abstract class AbstractLaunchScriptIntegrationTests {
|
|||
super(createImage(os, version));
|
||||
withCopyFileToContainer(MountableFile.forHostPath(findApplication().getAbsolutePath()), "/app.jar");
|
||||
withCopyFileToContainer(
|
||||
MountableFile.forHostPath("src/intTest/resources/scripts/" + scriptsDir + "test-functions.sh"),
|
||||
MountableFile.forHostPath("src/dockerTest/resources/scripts/" + scriptsDir + "test-functions.sh"),
|
||||
"/test-functions.sh");
|
||||
withCopyFileToContainer(
|
||||
MountableFile.forHostPath("src/intTest/resources/scripts/" + scriptsDir + testScript),
|
||||
MountableFile.forHostPath("src/dockerTest/resources/scripts/" + scriptsDir + testScript),
|
||||
"/" + testScript);
|
||||
withCommand("/bin/bash", "-c",
|
||||
"chown root:root *.sh && chown root:root *.jar && chmod +x " + testScript + " && ./" + testScript);
|
||||
|
@ -117,7 +117,7 @@ abstract class AbstractLaunchScriptIntegrationTests {
|
|||
ImageFromDockerfile image = new ImageFromDockerfile(
|
||||
"spring-boot-launch-script/" + os.toLowerCase() + "-" + version);
|
||||
image.withFileFromFile("Dockerfile",
|
||||
new File("src/intTest/resources/conf/" + os + "/" + version + "/Dockerfile"));
|
||||
new File("src/dockerTest/resources/conf/" + os + "/" + version + "/Dockerfile"));
|
||||
for (File file : new File("build/downloads/jdk/bellsoft").listFiles()) {
|
||||
image.withFileFromFile("downloads/" + file.getName(), file);
|
||||
}
|
Loading…
Reference in New Issue
Block a user