Reverted previously removed additions of tests that check for ftp:// or nonexistent-protocol:// using DownloadableURL. DownloadableURL's responsibility is not to have inherent knowledge of protocols that are available, but to format an invalid url/path to a valid url/path.

This commit is contained in:
Ali Rizvi-Santiago 2018-01-06 20:02:37 -06:00
parent 46a5ca30e5
commit 3cf448f6ec
2 changed files with 0 additions and 17 deletions

View File

@ -76,17 +76,6 @@ func TestNewConfig_sourcePath(t *testing.T) {
t.Fatalf("Nonexistant file should throw a validation error!")
}
// Bad
c = testConfig(t)
c["source_path"] = "nonexistent-protocol://i/dont/exist"
_, warns, err = NewConfig(c)
if len(warns) > 0 {
t.Fatalf("bad: %#v", warns)
}
if err == nil {
t.Fatalf("should error")
}
// Good
tf := getTempFile(t)
defer os.Remove(tf.Name())

View File

@ -43,12 +43,6 @@ func TestDownloadableURL(t *testing.T) {
t.Fatalf("expected err : %s", err)
}
// Invalid: unsupported scheme
_, err = DownloadableURL("nonexistent-protocol://host.com/path")
if err == nil {
t.Fatalf("expected err : %s", err)
}
// Valid: http
u, err := DownloadableURL("HTTP://packer.io/path")
if err != nil {