github.com/sl1pm4t/terraform@v0.6.4-0.20170725213156-870617d22df3/command/internal_plugin_test.go (about)

     1  package command
     2  
     3  import "testing"
     4  
     5  // providers are all external for now
     6  //func TestInternalPlugin_InternalProviders(t *testing.T) {
     7  //    // Note this is a randomish sample and does not check for all plugins
     8  //    for _, name := range []string{"atlas", "consul", "docker", "template"} {
     9  //        if _, ok := InternalProviders[name]; !ok {
    10  //            t.Errorf("Expected to find %s in InternalProviders", name)
    11  //        }
    12  //    }
    13  //}
    14  
    15  func TestInternalPlugin_InternalProvisioners(t *testing.T) {
    16  	for _, name := range []string{"chef", "file", "local-exec", "remote-exec"} {
    17  		if _, ok := InternalProvisioners[name]; !ok {
    18  			t.Errorf("Expected to find %s in InternalProvisioners", name)
    19  		}
    20  	}
    21  }
    22  
    23  func TestInternalPlugin_BuildPluginCommandString(t *testing.T) {
    24  	actual, err := BuildPluginCommandString("provisioner", "remote-exec")
    25  	if err != nil {
    26  		t.Fatalf(err.Error())
    27  	}
    28  
    29  	expected := "-TFSPACE-internal-plugin-TFSPACE-provisioner-TFSPACE-remote-exec"
    30  	if actual[len(actual)-len(expected):] != expected {
    31  		t.Errorf("Expected command to end with %s; got:\n%s\n", expected, actual)
    32  	}
    33  }