Skip to content

Commit 3c391bf

Browse files
authored
Maintain deterministic order in withCopyFileToContainer (#2897)
1 parent 6e8c18e commit 3c391bf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

core/src/main/java/org/testcontainers/containers/GenericContainer.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
import java.util.HashMap;
8080
import java.util.HashSet;
8181
import java.util.Iterator;
82+
import java.util.LinkedHashMap;
8283
import java.util.LinkedHashSet;
8384
import java.util.List;
8485
import java.util.Map;
@@ -180,7 +181,8 @@ public class GenericContainer<SELF extends GenericContainer<SELF>>
180181
@Nullable
181182
private Long shmSize;
182183

183-
private Map<MountableFile, String> copyToFileContainerPathMap = new HashMap<>();
184+
// Maintain order in which entries are added, as earlier target location may be a prefix of a later location.
185+
private Map<MountableFile, String> copyToFileContainerPathMap = new LinkedHashMap<>();
184186

185187
protected final Set<Startable> dependencies = new HashSet<>();
186188

0 commit comments

Comments
 (0)