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