github.com/recobe182/terraform@v0.8.5-0.20170117231232-49ab22a935b7/builtin/providers/nomad/provider_test.go (about) 1 package nomad 2 3 import ( 4 "os" 5 "testing" 6 7 "github.com/hashicorp/terraform/helper/schema" 8 "github.com/hashicorp/terraform/terraform" 9 ) 10 11 // How to run the acceptance tests for this provider: 12 // 13 // - Obtain an official Nomad release from https://nomadproject.io 14 // and extract the "nomad" binary 15 // 16 // - Run the following to start the Nomad agent in development mode: 17 // nomad agent -dev 18 // 19 // - Run the Terraform acceptance tests as usual: 20 // make testacc TEST=./builtin/providers/nomad 21 // 22 // The tests expect to be run in a fresh, empty Nomad server. 23 24 func TestProvider(t *testing.T) { 25 if err := Provider().(*schema.Provider).InternalValidate(); err != nil { 26 t.Fatalf("err: %s", err) 27 } 28 } 29 30 var testProvider *schema.Provider 31 var testProviders map[string]terraform.ResourceProvider 32 33 func init() { 34 testProvider = Provider().(*schema.Provider) 35 testProviders = map[string]terraform.ResourceProvider{ 36 "nomad": testProvider, 37 } 38 } 39 40 func testAccPreCheck(t *testing.T) { 41 if v := os.Getenv("NOMAD_ADDR"); v == "" { 42 os.Setenv("NOMAD_ADDR", "http://127.0.0.1:4646") 43 } 44 }