Modified common/download_test.go to not test the smb:// uri on platforms other than windows. Added an immediate platform error to SMBDownloader.Download as opposed to letting .toPath return it (which would have left the structure partially initialized).

This commit is contained in:
Ali Rizvi-Santiago 2017-03-23 15:29:38 -05:00
parent 4783b6508e
commit 5a4ce2165c
2 changed files with 20 additions and 10 deletions

View File

@ -637,6 +637,12 @@ func (d *SMBDownloader) toPath(base string, uri url.URL) (string, error) {
}
func (d *SMBDownloader) Download(dst *os.File, src *url.URL) error {
/* first we warn the world if we're not running windows */
if runtime.GOOS != "windows" {
return fmt.Errorf("Support for SMB based uri's are not supported on %s", runtime.GOOS)
}
d.active = false
/* convert the uri using the net/url module to a UNC path */

View File

@ -483,6 +483,9 @@ func TestFileUriTransforms(t *testing.T) {
t.Logf("TestFileUriTransforms : Result Path '%s'", res)
}
// smb protocol depends on platform support which currently
// only exists on windows.
if runtime.GOOS == "windows" {
// ...and finally the oddball windows native path
// smb://host/sharename/file -> \\host\sharename\file
testcase := host + "/" + share + "/" + cwd[1:] + "/%s"
@ -494,4 +497,5 @@ func TestFileUriTransforms(t *testing.T) {
return
}
t.Logf("TestFileUriTransforms : Result Path '%s'", res)
}
}