github.com/tam7t/terraform@v0.7.0-rc2.0.20160705125922-be2469a05c5e/builtin/providers/triton/provider_test.go (about)

     1  package triton
     2  
     3  import (
     4  	"os"
     5  	"testing"
     6  
     7  	"github.com/hashicorp/terraform/helper/schema"
     8  	"github.com/hashicorp/terraform/terraform"
     9  )
    10  
    11  var testAccProviders map[string]terraform.ResourceProvider
    12  var testAccProvider *schema.Provider
    13  
    14  func init() {
    15  	testAccProvider = Provider().(*schema.Provider)
    16  	testAccProviders = map[string]terraform.ResourceProvider{
    17  		"triton": testAccProvider,
    18  	}
    19  }
    20  
    21  func TestProvider(t *testing.T) {
    22  	if err := Provider().(*schema.Provider).InternalValidate(); err != nil {
    23  		t.Fatalf("err: %s", err)
    24  	}
    25  }
    26  
    27  func TestProvider_impl(t *testing.T) {
    28  	var _ terraform.ResourceProvider = Provider()
    29  }
    30  
    31  func testAccPreCheck(t *testing.T) {
    32  	sdcURL := os.Getenv("SDC_URL")
    33  	account := os.Getenv("SDC_ACCOUNT")
    34  	keyID := os.Getenv("SDC_KEY_ID")
    35  	keyMaterial := os.Getenv("SDC_KEY_MATERIAL")
    36  
    37  	if sdcURL == "" {
    38  		sdcURL = "https://us-west-1.api.joyentcloud.com"
    39  	}
    40  
    41  	if sdcURL == "" || account == "" || keyID == "" || keyMaterial == "" {
    42  		t.Fatal("SDC_ACCOUNT, SDC_KEY_ID and SDC_KEY_MATERIAL must be set for acceptance tests")
    43  	}
    44  }