add test for local fs download
This commit is contained in:
parent
197a283b5e
commit
e9549d2688
@ -179,8 +179,9 @@ func (s *StepDownload) download(ctx context.Context, ui packer.Ui, source string
|
|||||||
// subdirectory command, which it most likely isn't.
|
// subdirectory command, which it most likely isn't.
|
||||||
src = filepath.Clean(u.String())
|
src = filepath.Clean(u.String())
|
||||||
if _, err := os.Stat(filepath.Clean(u.Path)); err != nil {
|
if _, err := os.Stat(filepath.Clean(u.Path)); err != nil {
|
||||||
// Cleaned path isn't actually present on system so it must be some
|
// Cleaned path isn't present on system so it must be some other
|
||||||
// other weird thing; see if go-getter can figure it out.
|
// scheme. Don't error right away; see if go-getter can figure it
|
||||||
|
// out.
|
||||||
src = u.String()
|
src = u.String()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,6 +71,14 @@ func TestStepDownload_Run(t *testing.T) {
|
|||||||
toSha1(abs(t, "./test-fixtures/root/another.txt")) + ".lock",
|
toSha1(abs(t, "./test-fixtures/root/another.txt")) + ".lock",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{"double slashes on a local filesystem passes",
|
||||||
|
fields{Url: []string{abs(t, "./test-fixtures/root//another.txt")}},
|
||||||
|
multistep.ActionContinue,
|
||||||
|
[]string{
|
||||||
|
toSha1(abs(t, "./test-fixtures/root//another.txt")),
|
||||||
|
toSha1(abs(t, "./test-fixtures/root//another.txt")) + ".lock",
|
||||||
|
},
|
||||||
|
},
|
||||||
{"none checksum works, without a checksum",
|
{"none checksum works, without a checksum",
|
||||||
fields{Url: []string{abs(t, "./test-fixtures/root/another.txt")}, ChecksumType: "none"},
|
fields{Url: []string{abs(t, "./test-fixtures/root/another.txt")}, ChecksumType: "none"},
|
||||||
multistep.ActionContinue,
|
multistep.ActionContinue,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user