github.com/tam7t/terraform@v0.7.0-rc2.0.20160705125922-be2469a05c5e/communicator/communicator_test.go (about) 1 package communicator 2 3 import ( 4 "testing" 5 6 "github.com/hashicorp/terraform/terraform" 7 ) 8 9 func TestCommunicator_new(t *testing.T) { 10 r := &terraform.InstanceState{ 11 Ephemeral: terraform.EphemeralState{ 12 ConnInfo: map[string]string{ 13 "type": "telnet", 14 }, 15 }, 16 } 17 if _, err := New(r); err == nil { 18 t.Fatalf("expected error with telnet") 19 } 20 21 r.Ephemeral.ConnInfo["type"] = "ssh" 22 if _, err := New(r); err != nil { 23 t.Fatalf("err: %v", err) 24 } 25 26 r.Ephemeral.ConnInfo["type"] = "winrm" 27 if _, err := New(r); err != nil { 28 t.Fatalf("err: %v", err) 29 } 30 }