Addressing review comments

This commit is contained in:
Don McCasland 2019-10-07 10:46:28 -07:00
parent dbabcb1f5f
commit 4e1639c030
No known key found for this signature in database
GPG Key ID: 2B332A542CE5FE1B
2 changed files with 5 additions and 6 deletions

View File

@ -30,17 +30,17 @@ import (
var copyTests = []struct { var copyTests = []struct {
name string name string
SourcesAndDest []string sourcesAndDest []string
expectedDest []string expectedDest []string
}{ }{
{ {
name: "copy foo into tempCopyExecuteTest/", name: "copy foo into tempCopyExecuteTest/",
SourcesAndDest: []string{"foo", "tempCopyExecuteTest/"}, sourcesAndDest: []string{"foo", "tempCopyExecuteTest/"},
expectedDest: []string{"foo"}, expectedDest: []string{"foo"},
}, },
{ {
name: "copy foo into tempCopyExecuteTest", name: "copy foo into tempCopyExecuteTest",
SourcesAndDest: []string{"foo", "tempCopyExecuteTest"}, sourcesAndDest: []string{"foo", "tempCopyExecuteTest"},
expectedDest: []string{"tempCopyExecuteTest"}, expectedDest: []string{"tempCopyExecuteTest"},
}, },
} }
@ -60,13 +60,13 @@ func TestCopyExecuteCmd(t *testing.T) {
cmd := CopyCommand{ cmd := CopyCommand{
cmd: &instructions.CopyCommand{ cmd: &instructions.CopyCommand{
SourcesAndDest: test.SourcesAndDest, SourcesAndDest: test.sourcesAndDest,
}, },
buildcontext: "../../integration/context/", buildcontext: "../../integration/context/",
} }
buildArgs := copySetUpBuildArgs() buildArgs := copySetUpBuildArgs()
dest := cfg.WorkingDir + test.SourcesAndDest[len(test.SourcesAndDest)-1] dest := cfg.WorkingDir + test.sourcesAndDest[len(test.sourcesAndDest)-1]
os.RemoveAll(dest) os.RemoveAll(dest)

View File

@ -193,7 +193,6 @@ func extractFile(dest string, hdr *tar.Header, tr io.Reader) error {
fi, err := os.Stat(dir) fi, err := os.Stat(dir)
if os.IsNotExist(err) || !fi.IsDir() { if os.IsNotExist(err) || !fi.IsDir() {
logrus.Infof("base %s for file %s does not exist. Creating.", base, path) logrus.Infof("base %s for file %s does not exist. Creating.", base, path)
//os.RemoveAll(dir)
if err := os.MkdirAll(dir, 0755); err != nil { if err := os.MkdirAll(dir, 0755); err != nil {
return err return err
} }