providers/aws: add failing test for aws region validation

cc/ @jorgeng87
This commit is contained in:
Jack Pearkes 2014-07-29 19:09:17 -04:00
parent 872acb3740
commit 77697b9936
1 changed files with 20 additions and 0 deletions

View File

@ -54,6 +54,26 @@ func TestResourceProvider_Configure(t *testing.T) {
}
}
func TestResourceProvider_ConfigureBadRegion(t *testing.T) {
rp := new(ResourceProvider)
raw := map[string]interface{}{
"access_key": "foo",
"secret_key": "bar",
"region": "blah",
}
rawConfig, err := config.NewRawConfig(raw)
if err != nil {
t.Fatalf("err: %s", err)
}
err = rp.Configure(terraform.NewResourceConfig(rawConfig))
if err == nil {
t.Fatalf("should have err: bad region")
}
}
func testAccPreCheck(t *testing.T) {
if v := os.Getenv("AWS_ACCESS_KEY"); v == "" {
t.Fatal("AWS_ACCESS_KEY must be set for acceptance tests")