From 3cf448f6ec8b5339619ba6d0435e80d1eee7a8ac Mon Sep 17 00:00:00 2001 From: Ali Rizvi-Santiago Date: Sat, 6 Jan 2018 20:02:37 -0600 Subject: [PATCH] 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. --- builder/virtualbox/ovf/config_test.go | 11 ----------- common/config_test.go | 6 ------ 2 files changed, 17 deletions(-) diff --git a/builder/virtualbox/ovf/config_test.go b/builder/virtualbox/ovf/config_test.go index baba657a8..e9c536e54 100644 --- a/builder/virtualbox/ovf/config_test.go +++ b/builder/virtualbox/ovf/config_test.go @@ -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()) diff --git a/common/config_test.go b/common/config_test.go index bb2889f33..da93a19ef 100644 --- a/common/config_test.go +++ b/common/config_test.go @@ -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 {