Skip to content

Commit

Permalink
Maintain deterministic order in withCopyFileToContainer
Browse files Browse the repository at this point in the history
`withCopyFileToContainer` can be invoked multiple times, including with
one `containerPath` being prefix of another `containerPath`.

This change makes the end result deterministic.
  • Loading branch information
findepi committed Jun 30, 2020
1 parent 25a9aa5 commit 62bcd0b
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -179,7 +180,8 @@ public class GenericContainer<SELF extends GenericContainer<SELF>>
@Nullable
private Long shmSize;

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

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

Expand Down

0 comments on commit 62bcd0b

Please sign in to comment.