Skip to content

Commit

Permalink
Merge pull request #354 from Lucaber/fix/mount-map
Browse files Browse the repository at this point in the history
Swap incorrect key and value of BindMounts and VolumeMounts
  • Loading branch information
gianarb committed Nov 19, 2021
2 parents 3e32ca0 + 3eed4e2 commit 1517941
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docker.go
Expand Up @@ -743,14 +743,14 @@ func (p *DockerProvider) CreateContainer(ctx context.Context, req ContainerReque

// prepare mounts
mounts := []mount.Mount{}
for hostPath, innerPath := range req.BindMounts {
for innerPath, hostPath := range req.BindMounts {
mounts = append(mounts, mount.Mount{
Type: mount.TypeBind,
Source: hostPath,
Target: innerPath,
})
}
for volumeName, innerPath := range req.VolumeMounts {
for innerPath, volumeName := range req.VolumeMounts {
mounts = append(mounts, mount.Mount{
Type: mount.TypeVolume,
Source: volumeName,
Expand Down
4 changes: 2 additions & 2 deletions docker_test.go
Expand Up @@ -1404,8 +1404,8 @@ func TestContainerCreationWithBindAndVolume(t *testing.T) {
bashC, err := GenericContainer(ctx, GenericContainerRequest{
ContainerRequest: ContainerRequest{
Image: "bash",
BindMounts: map[string]string{absPath: "/hello.sh"},
VolumeMounts: map[string]string{volumeName: "/data"},
BindMounts: map[string]string{"/hello.sh": absPath},
VolumeMounts: map[string]string{"/data": volumeName},
Cmd: []string{"bash", "/hello.sh"},
WaitingFor: wait.ForLog("done"),
},
Expand Down

0 comments on commit 1517941

Please sign in to comment.