github.com/chalford/terraform@v0.3.7-0.20150113080010-a78c69a8c81f/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_ACCESS_KEY"); v == "" {
    34  		t.Fatal("AWS_ACCESS_KEY must be set for acceptance tests")
    35  	}
    36  	if v := os.Getenv("AWS_SECRET_KEY"); v == "" {
    37  		t.Fatal("AWS_SECRET_KEY must be set for acceptance tests")
    38  	}
    39  	if v := os.Getenv("AWS_REGION"); v == "" {
    40  		log.Println("[INFO] Test: Using us-west-2 as test region")
    41  		os.Setenv("AWS_REGION", "us-west-2")
    42  	}
    43  }