diff --git a/helper/communicator/config_test.go b/helper/communicator/config_test.go index 688f56c55..4f717270b 100644 --- a/helper/communicator/config_test.go +++ b/helper/communicator/config_test.go @@ -4,6 +4,7 @@ import ( "reflect" "testing" + "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/template/interpolate" "github.com/masterzen/winrm" ) @@ -138,6 +139,40 @@ func TestConfig_winrm_use_ntlm(t *testing.T) { } +func TestSSHConfigFunc(t *testing.T) { + state := new(multistep.BasicStateBag) + + // No ciphers set + c := &Config{ + Type: "ssh", + } + + f := c.SSHConfigFunc() + sshConfig, _ := f(state) + if sshConfig.Config.Ciphers != nil { + t.Fatalf("Shouldn't set SSHCiphers if communicator config option " + + "ssh_ciphers is unset.") + } + + // Ciphers are set + c = &Config{ + Type: "ssh", + SSH: SSH{ + SSHCiphers: []string{"partycipher"}, + }, + } + f = c.SSHConfigFunc() + sshConfig, _ = f(state) + if sshConfig.Config.Ciphers == nil { + t.Fatalf("Shouldn't set SSHCiphers if communicator config option " + + "ssh_ciphers is unset.") + } + if sshConfig.Config.Ciphers[0] != "partycipher" { + t.Fatalf("ssh_ciphers should be a direct passthrough.") + } + +} + func TestConfig_winrm(t *testing.T) { c := &Config{ Type: "winrm",