This commit is contained in:
Moritz Halbritter 2023-08-10 14:45:25 +02:00
parent f54d370fcd
commit 6a65ca13ea
1 changed files with 7 additions and 2 deletions

View File

@ -83,9 +83,14 @@ public abstract class AbstractDockerComposeIntegrationTests {
private File transformedComposeFile(File composeFile, DockerImageName imageName) {
File tempComposeFile = Path.of(tempDir.toString(), composeFile.getName()).toFile();
try {
String composeFileContent = FileCopyUtils.copyToString(new FileReader(composeFile));
String composeFileContent;
try (FileReader reader = new FileReader(composeFile)) {
composeFileContent = FileCopyUtils.copyToString(reader);
}
composeFileContent = composeFileContent.replace("{imageName}", imageName.asCanonicalNameString());
FileCopyUtils.copy(composeFileContent, new FileWriter(tempComposeFile));
try (FileWriter writer = new FileWriter(tempComposeFile)) {
FileCopyUtils.copy(composeFileContent, writer);
}
}
catch (IOException ex) {
fail("Error transforming Docker compose file '" + composeFile + "' to '" + tempComposeFile + "': "