From efcdf60d96a05364dfc1074fc74c4b9995f3c1a1 Mon Sep 17 00:00:00 2001 From: DanHam Date: Sat, 9 Jun 2018 08:54:20 +0100 Subject: [PATCH] Add tests to ensure remote_password is set when exporting with ovftool --- builder/vmware/iso/builder_test.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/builder/vmware/iso/builder_test.go b/builder/vmware/iso/builder_test.go index 067e0483b..d1a7282a9 100644 --- a/builder/vmware/iso/builder_test.go +++ b/builder/vmware/iso/builder_test.go @@ -182,6 +182,34 @@ func TestBuilderPrepare_RemoteType(t *testing.T) { } } +func TestBuilderPrepare_RemoteExport(t *testing.T) { + var b Builder + config := testConfig() + + config["remote_type"] = "esx5" + config["remote_host"] = "foobar.example.com" + // Bad + config["remote_password"] = "" + warns, err := b.Prepare(config) + if len(warns) != 0 { + t.Fatalf("bad: %#v", warns) + } + if err == nil { + t.Fatal("should have error") + } + + // Good + config["remote_password"] = "supersecret" + b = Builder{} + warns, err = b.Prepare(config) + if len(warns) != 0 { + t.Fatalf("err: %s", err) + } + if err != nil { + t.Fatalf("should not have error: %s", err) + } +} + func TestBuilderPrepare_Format(t *testing.T) { var b Builder config := testConfig()