terraform-provider-google/google/gcp_sweeper_test.go

35 lines
734 B
Go

package google
import (
"fmt"
"testing"
"github.com/hashicorp/terraform/helper/resource"
)
func TestMain(m *testing.M) {
resource.TestMain(m)
}
// sharedConfigForRegion returns a common config setup needed for the sweeper
// functions for a given region
func sharedConfigForRegion(region string) (*Config, error) {
project := getTestProjectFromEnv()
if project == "" {
return nil, fmt.Errorf("set project using any of these env variables %v", projectEnvVars)
}
creds := getTestCredsFromEnv()
if creds == "" {
return nil, fmt.Errorf("set credentials using any of these env variables %v", credsEnvVars)
}
conf := &Config{
Credentials: creds,
Region: region,
Project: project,
}
return conf, nil
}