terraform-provider-google/provider_test.go
Paul Hinze 4bc9add477 providers/google: fix instance creation
with this commit, the google compute instance acceptance tests are
passing

 - remove GOOGLE_CLIENT_FILE requirement from provider tests to finish
   out #452
 - skip extra "#" key that shows up in metadata maps, fixes #757 and
   sprouts #883 to figure out core issue
 - more verbose variablenames in metadata parsing, since it took me
   awhile to grok and i thought there might have been a shadowing bug in
   there for a minute. maybe someday when i'm a golang master i'll be
   smart enough to be comfortable with one-char varnames. :)
2015-01-28 15:50:56 -06:00

44 lines
1.0 KiB
Go

package google
import (
"os"
"testing"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/terraform"
)
var testAccProviders map[string]terraform.ResourceProvider
var testAccProvider *schema.Provider
func init() {
testAccProvider = Provider().(*schema.Provider)
testAccProviders = map[string]terraform.ResourceProvider{
"google": testAccProvider,
}
}
func TestProvider(t *testing.T) {
if err := Provider().(*schema.Provider).InternalValidate(); err != nil {
t.Fatalf("err: %s", err)
}
}
func TestProvider_impl(t *testing.T) {
var _ terraform.ResourceProvider = Provider()
}
func testAccPreCheck(t *testing.T) {
if v := os.Getenv("GOOGLE_ACCOUNT_FILE"); v == "" {
t.Fatal("GOOGLE_ACCOUNT_FILE must be set for acceptance tests")
}
if v := os.Getenv("GOOGLE_PROJECT"); v == "" {
t.Fatal("GOOGLE_PROJECT must be set for acceptance tests")
}
if v := os.Getenv("GOOGLE_REGION"); v != "us-central1" {
t.Fatal("GOOGLE_REGION must be set to us-central1 for acceptance tests")
}
}