added unit tests

This commit is contained in:
Joe Khoobyar 2018-03-30 22:01:49 -04:00
parent 481be9da35
commit 9766cc0aa5
2 changed files with 38 additions and 0 deletions

View File

@ -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().

View File

@ -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)
}