github.com/richardmarshall/terraform@v0.9.5-0.20170429023105-15704cc6ee35/builtin/providers/rabbitmq/provider_test.go (about)

     1  package rabbitmq
     2  
     3  import (
     4  	"os"
     5  	"testing"
     6  
     7  	"github.com/hashicorp/terraform/helper/schema"
     8  	"github.com/hashicorp/terraform/terraform"
     9  )
    10  
    11  // To run these acceptance tests, you will need access to a RabbitMQ server
    12  // with the management plugin enabled.
    13  //
    14  // Set the RABBITMQ_ENDPOINT, RABBITMQ_USERNAME, and RABBITMQ_PASSWORD
    15  // environment variables before running the tests.
    16  //
    17  // You can run the tests like this:
    18  //    make testacc TEST=./builtin/providers/rabbitmq
    19  
    20  var testAccProviders map[string]terraform.ResourceProvider
    21  var testAccProvider *schema.Provider
    22  
    23  func init() {
    24  	testAccProvider = Provider().(*schema.Provider)
    25  	testAccProviders = map[string]terraform.ResourceProvider{
    26  		"rabbitmq": testAccProvider,
    27  	}
    28  }
    29  
    30  func TestProvider(t *testing.T) {
    31  	if err := Provider().(*schema.Provider).InternalValidate(); err != nil {
    32  		t.Fatalf("err: %s", err)
    33  	}
    34  }
    35  
    36  func TestProvider_impl(t *testing.T) {
    37  	var _ terraform.ResourceProvider = Provider()
    38  }
    39  
    40  func testAccPreCheck(t *testing.T) {
    41  	for _, name := range []string{"RABBITMQ_ENDPOINT", "RABBITMQ_USERNAME", "RABBITMQ_PASSWORD"} {
    42  		if v := os.Getenv(name); v == "" {
    43  			t.Fatal("RABBITMQ_ENDPOINT, RABBITMQ_USERNAME and RABBITMQ_PASSWORD must be set for acceptance tests")
    44  		}
    45  	}
    46  }