add tests
This commit is contained in:
parent
a75cf67b5e
commit
cacdb0ca02
@ -4,6 +4,7 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/hashicorp/packer/helper/multistep"
|
||||||
"github.com/hashicorp/packer/template/interpolate"
|
"github.com/hashicorp/packer/template/interpolate"
|
||||||
"github.com/masterzen/winrm"
|
"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) {
|
func TestConfig_winrm(t *testing.T) {
|
||||||
c := &Config{
|
c := &Config{
|
||||||
Type: "winrm",
|
Type: "winrm",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user