github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/builtin/providers/aws/provider_test.go (about) 1 package aws 2 3 import ( 4 "log" 5 "os" 6 "testing" 7 8 "github.com/hashicorp/terraform/builtin/providers/template" 9 "github.com/hashicorp/terraform/helper/schema" 10 "github.com/hashicorp/terraform/terraform" 11 ) 12 13 var testAccProviders map[string]terraform.ResourceProvider 14 var testAccProvider *schema.Provider 15 var testAccTemplateProvider *schema.Provider 16 17 func init() { 18 testAccProvider = Provider().(*schema.Provider) 19 testAccTemplateProvider = template.Provider().(*schema.Provider) 20 testAccProviders = map[string]terraform.ResourceProvider{ 21 "aws": testAccProvider, 22 "template": testAccTemplateProvider, 23 } 24 } 25 26 func TestProvider(t *testing.T) { 27 if err := Provider().(*schema.Provider).InternalValidate(); err != nil { 28 t.Fatalf("err: %s", err) 29 } 30 } 31 32 func TestProvider_impl(t *testing.T) { 33 var _ terraform.ResourceProvider = Provider() 34 } 35 36 func testAccPreCheck(t *testing.T) { 37 if v := os.Getenv("AWS_PROFILE"); v == "" { 38 if v := os.Getenv("AWS_ACCESS_KEY_ID"); v == "" { 39 t.Fatal("AWS_ACCESS_KEY_ID must be set for acceptance tests") 40 } 41 if v := os.Getenv("AWS_SECRET_ACCESS_KEY"); v == "" { 42 t.Fatal("AWS_SECRET_ACCESS_KEY must be set for acceptance tests") 43 } 44 } 45 if v := os.Getenv("AWS_DEFAULT_REGION"); v == "" { 46 log.Println("[INFO] Test: Using us-west-2 as test region") 47 os.Setenv("AWS_DEFAULT_REGION", "us-west-2") 48 } 49 }