diff --git a/communicator/winrm/communicator_test.go b/communicator/winrm/communicator_test.go index d903fbc2e..4dd06cd99 100644 --- a/communicator/winrm/communicator_test.go +++ b/communicator/winrm/communicator_test.go @@ -155,6 +155,40 @@ func TestScriptPath(t *testing.T) { } } +func TestTransportDecorator(t *testing.T) { + wrm := newMockWinRMServer(t) + defer wrm.Close() + + r := &terraform.InstanceState{ + Ephemeral: terraform.EphemeralState{ + ConnInfo: map[string]string{ + "type": "winrm", + "user": "user", + "password": "pass", + "host": wrm.Host, + "port": strconv.Itoa(wrm.Port), + "use_ntlm": "true", + "timeout": "30s", + }, + }, + } + + c, err := New(r) + if err != nil { + t.Fatalf("error creating communicator: %s", err) + } + + err = c.Connect(nil) + if err != nil { + t.Fatalf("error connecting communicator: %s", err) + } + defer c.Disconnect() + + if c.client.TransportDecorator == nil { + t.Fatal("bad TransportDecorator: got nil") + } +} + func TestScriptPath_randSeed(t *testing.T) { // Pre GH-4186 fix, this value was the deterministic start the pseudorandom // chain of unseeded math/rand values for Int31(). diff --git a/communicator/winrm/provisioner_test.go b/communicator/winrm/provisioner_test.go index b86576bf3..e2494657f 100644 --- a/communicator/winrm/provisioner_test.go +++ b/communicator/winrm/provisioner_test.go @@ -16,6 +16,7 @@ func TestProvisioner_connInfo(t *testing.T) { "host": "127.0.0.1", "port": "5985", "https": "true", + "use_ntlm": "true", "timeout": "30s", }, }, @@ -41,6 +42,9 @@ func TestProvisioner_connInfo(t *testing.T) { if conf.HTTPS != true { t.Fatalf("expected: %v: got: %v", true, conf) } + if conf.NTLM != true { + t.Fatalf("expected: %v: got: %v", true, conf) + } if conf.Timeout != "30s" { t.Fatalf("expected: %v: got: %v", "30s", conf) }