2017-06-06 15:34:17 +00:00
|
|
|
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) {
|
2017-11-21 17:34:32 +00:00
|
|
|
project := getTestProjectFromEnv()
|
2017-06-06 15:34:17 +00:00
|
|
|
if project == "" {
|
2017-11-21 17:34:32 +00:00
|
|
|
return nil, fmt.Errorf("set project using any of these env variables %v", projectEnvVars)
|
2017-06-06 15:34:17 +00:00
|
|
|
}
|
|
|
|
|
2017-11-21 17:34:32 +00:00
|
|
|
creds := getTestCredsFromEnv()
|
2017-06-06 15:34:17 +00:00
|
|
|
if creds == "" {
|
2017-11-21 17:34:32 +00:00
|
|
|
return nil, fmt.Errorf("set credentials using any of these env variables %v", credsEnvVars)
|
2017-06-06 15:34:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
conf := &Config{
|
|
|
|
Credentials: creds,
|
|
|
|
Region: region,
|
|
|
|
Project: project,
|
|
|
|
}
|
|
|
|
|
|
|
|
return conf, nil
|
|
|
|
}
|