Add 4 testing scenarios for WinRM helper communicator config.

This commit is contained in:
Ilias Bertsimas 2016-03-02 11:48:20 +00:00
parent 883e4bcae2
commit 918c88ac38
1 changed files with 64 additions and 0 deletions

View File

@ -37,6 +37,70 @@ func TestConfig_badtype(t *testing.T) {
}
}
func TestConfig_winrm_noport(t *testing.T) {
c := &Config{
Type: "winrm",
WinRMUser: "admin",
}
if err := c.Prepare(testContext(t)); len(err) > 0 {
t.Fatalf("bad: %#v", err)
}
if c.WinRMPort != 5985 {
t.Fatalf("WinRMPort doesn't match default port 5985 when SSL is not enabled and no port is specified.")
}
}
func TestConfig_winrm_noport_ssl(t *testing.T) {
c := &Config{
Type: "winrm",
WinRMUser: "admin",
WinRMUseSSL: true,
}
if err := c.Prepare(testContext(t)); len(err) > 0 {
t.Fatalf("bad: %#v", err)
}
if c.WinRMPort != 5986 {
t.Fatalf("WinRMPort doesn't match default port 5986 when SSL is enabled and no port is specified.")
}
}
func TestConfig_winrm_port(t *testing.T) {
c := &Config{
Type: "winrm",
WinRMUser: "admin",
WinRMPort: 5509,
}
if err := c.Prepare(testContext(t)); len(err) > 0 {
t.Fatalf("bad: %#v", err)
}
if c.WinRMPort != 5509 {
t.Fatalf("WinRMPort doesn't match custom port 5509 when SSL is not enabled.")
}
}
func TestConfig_winrm_port_ssl(t *testing.T) {
c := &Config{
Type: "winrm",
WinRMUser: "admin",
WinRMPort: 5510,
WinRMUseSSL: true,
}
if err := c.Prepare(testContext(t)); len(err) > 0 {
t.Fatalf("bad: %#v", err)
}
if c.WinRMPort != 5510 {
t.Fatalf("WinRMPort doesn't match custom port 5510 when SSL is enabled.")
}
}
func TestConfig_winrm(t *testing.T) {
c := &Config{
Type: "winrm",