mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-27 00:46:25 -06:00
added unit tests
This commit is contained in:
parent
481be9da35
commit
9766cc0aa5
@ -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().
|
||||
|
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user