|
3 | 3 | import com.google.common.collect.ImmutableMap; |
4 | 4 | import com.google.common.collect.Sets; |
5 | 5 | import lombok.SneakyThrows; |
| 6 | +import org.junit.Rule; |
6 | 7 | import org.junit.Test; |
| 8 | +import org.junit.rules.TemporaryFolder; |
7 | 9 |
|
8 | 10 | import java.io.File; |
| 11 | +import java.io.PrintWriter; |
9 | 12 | import java.util.Collections; |
10 | 13 |
|
11 | 14 | import static org.assertj.core.api.Assertions.assertThat; |
| 15 | +import static org.assertj.core.api.Assertions.assertThatNoException; |
12 | 16 | import static org.assertj.core.api.Assertions.assertThatThrownBy; |
13 | 17 | import static org.assertj.core.api.Assertions.entry; |
14 | 18 |
|
15 | 19 | public class ParsedDockerComposeFileValidationTest { |
16 | 20 |
|
| 21 | + @Rule |
| 22 | + public TemporaryFolder temporaryFolder = new TemporaryFolder(); |
| 23 | + |
17 | 24 | @Test |
18 | 25 | public void shouldValidate() { |
19 | 26 | File file = new File("src/test/resources/docker-compose-container-name-v1.yml"); |
@@ -129,4 +136,22 @@ public void shouldObtainImageFromDockerfileBuildWithContext() { |
129 | 136 | entry("custom", Sets.newHashSet("alpine:3.17")) |
130 | 137 | ); // redis, mysql from compose file, alpine:3.17 from Dockerfile build |
131 | 138 | } |
| 139 | + |
| 140 | + @Test |
| 141 | + public void shouldSupportALotOfAliases() throws Exception { |
| 142 | + File file = temporaryFolder.newFile(); |
| 143 | + try (PrintWriter writer = new PrintWriter(file)) { |
| 144 | + writer.println("x-entry: &entry"); |
| 145 | + writer.println(" key: value"); |
| 146 | + writer.println(); |
| 147 | + writer.println("services:"); |
| 148 | + for (int i = 0; i < 1_000; i++) { |
| 149 | + writer.println(" service" + i + ":"); |
| 150 | + writer.println(" image: busybox"); |
| 151 | + writer.println(" environment:"); |
| 152 | + writer.println(" <<: *entry"); |
| 153 | + } |
| 154 | + } |
| 155 | + assertThatNoException().isThrownBy(() -> new ParsedDockerComposeFile(file)); |
| 156 | + } |
132 | 157 | } |
0 commit comments