github.com/turtlemonvh/terraform@v0.6.9-0.20151204001754-8e40b6b855e8/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  }