Skip to content

Commit

Permalink
verify dest dir is also parsed for env values
Browse files Browse the repository at this point in the history
  • Loading branch information
apoorvam committed Jun 15, 2019
1 parent dae7504 commit 8a3bb77
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,6 @@ func parseEnv(configs *Configs) error {
// DecodeMount parses mount format for directories to be mounted as bind volumes
func DecodeMount(mounts []string, step *docker.Step) error {
for _, m := range mounts {

arr := strings.Split(
strings.Trim(strings.Trim(m, `'`), `"`),
":",
Expand Down
7 changes: 5 additions & 2 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ func TestDecodeMount(t *testing.T) {

func TestDecodeMountWithEnvironmentVariable(t *testing.T) {
step := &docker.Step{}
mounts := []string{"`$HOME`:/app"}
mounts := []string{"`$HOME`:`$HOME`"}

err := DecodeMount(mounts, step)

Expand All @@ -349,6 +349,9 @@ func TestDecodeMountWithEnvironmentVariable(t *testing.T) {
t.Fatalf("expected ExtMounts to be of length 1, got %d", len((*step).ExtMounts))
}
if (*step).ExtMounts[0].Source != util.HomeDir {
t.Fatalf("expected ExtMounts to be %s, got %s", util.HomeDir, (*step).ExtMounts[0].Source)
t.Fatalf("expected ExtMounts Source to be %s, got %s", util.HomeDir, (*step).ExtMounts[0].Source)
}
if (*step).ExtMounts[0].Target != util.HomeDir {
t.Fatalf("expected ExtMounts Source to be %s, got %s", util.HomeDir, (*step).ExtMounts[0].Target)
}
}

0 comments on commit 8a3bb77

Please sign in to comment.