From 4cd3429914c3d78a35b7110db77f282a6abd3585 Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Fri, 5 Jun 2020 10:15:11 -0700 Subject: [PATCH] add ssh override test --- builder/vmware/common/ssh_test.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 builder/vmware/common/ssh_test.go diff --git a/builder/vmware/common/ssh_test.go b/builder/vmware/common/ssh_test.go new file mode 100644 index 000000000..7b46e1531 --- /dev/null +++ b/builder/vmware/common/ssh_test.go @@ -0,0 +1,28 @@ +package common + +import ( + "testing" + + "github.com/hashicorp/packer/helper/communicator" +) + +func TestCommHost(t *testing.T) { + state := testState(t) + config := SSHConfig{ + Comm: communicator.Config{ + SSH: communicator.SSH{ + SSHHost: "127.0.0.1", + }, + }, + } + + hostFunc := CommHost(&config) + out, err := hostFunc(state) + if err != nil { + t.Fatalf("Should not have had an error") + } + + if out != "127.0.0.1" { + t.Fatalf("Should have respected ssh override.") + } +}