github.com/mohanarpit/terraform@v0.6.16-0.20160909104007-291f29853544/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/helper/schema" 9 "github.com/hashicorp/terraform/terraform" 10 ) 11 12 var testAccProviders map[string]terraform.ResourceProvider 13 var testAccProvider *schema.Provider 14 15 func init() { 16 testAccProvider = Provider().(*schema.Provider) 17 testAccProviders = map[string]terraform.ResourceProvider{ 18 "aws": testAccProvider, 19 } 20 } 21 22 func TestProvider(t *testing.T) { 23 if err := Provider().(*schema.Provider).InternalValidate(); err != nil { 24 t.Fatalf("err: %s", err) 25 } 26 } 27 28 func TestProvider_impl(t *testing.T) { 29 var _ terraform.ResourceProvider = Provider() 30 } 31 32 func testAccPreCheck(t *testing.T) { 33 if v := os.Getenv("AWS_PROFILE"); v == "" { 34 if v := os.Getenv("AWS_ACCESS_KEY_ID"); v == "" { 35 t.Fatal("AWS_ACCESS_KEY_ID must be set for acceptance tests") 36 } 37 if v := os.Getenv("AWS_SECRET_ACCESS_KEY"); v == "" { 38 t.Fatal("AWS_SECRET_ACCESS_KEY must be set for acceptance tests") 39 } 40 } 41 if v := os.Getenv("AWS_DEFAULT_REGION"); v == "" { 42 log.Println("[INFO] Test: Using us-west-2 as test region") 43 os.Setenv("AWS_DEFAULT_REGION", "us-west-2") 44 } 45 }