github.com/minamijoyo/terraform@v0.7.8-0.20161029001309-18b3736ba44b/builtin/providers/postgresql/provider_test.go (about)

     1  package postgresql
     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  		"postgresql": 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  	var host string
    33  	if host = os.Getenv("PGHOST"); host == "" {
    34  		t.Fatal("PGHOST must be set for acceptance tests")
    35  	}
    36  	if v := os.Getenv("PGUSER"); v == "" {
    37  		t.Fatal("PGUSER must be set for acceptance tests")
    38  	}
    39  	if v := os.Getenv("PGPASSWORD"); v == "" && host != "localhost" {
    40  		t.Fatal("PGPASSWORD must be set for acceptance tests if PGHOST is not localhost")
    41  	}
    42  }