Make pool name configurable in tests

This commit is contained in:
Julien Vey 2015-02-09 13:27:30 +01:00 committed by Jon Perritt
parent 760e03856e
commit 132d5acb33
3 changed files with 11 additions and 4 deletions

View File

@ -10,6 +10,7 @@ import (
var (
OS_REGION_NAME = ""
OS_POOL_NAME = ""
)
var testAccProviders map[string]terraform.ResourceProvider
@ -49,6 +50,12 @@ func testAccPreCheck(t *testing.T) {
t.Fatal("OS_IMAGE_ID must be set for acceptance tests")
}
v = os.Getenv("OS_POOL_NAME")
if v == "" {
t.Fatal("OS_POOL_NAME must be set for acceptance tests")
}
OS_POOL_NAME = v
v = os.Getenv("OS_FLAVOR_ID")
if v == "" {
t.Fatal("OS_FLAVOR_ID must be set for acceptance tests")

View File

@ -224,7 +224,7 @@ func resourceComputeInstanceV2Create(d *schema.ResourceData, meta interface{}) e
server.ID, err)
}
floatingIP := d.Get("floating_ip").(string)
if len(floatingIP) > 0 {
if floatingIP != "" {
networkingClient, err := config.networkingV2Client(d.Get("region").(string))
if err != nil {
return fmt.Errorf("Error creating OpenStack compute client: %s", err)
@ -401,7 +401,7 @@ func resourceComputeInstanceV2Update(d *schema.ResourceData, meta interface{}) e
if d.HasChange("floating_ip") {
floatingIP := d.Get("floating_ip").(string)
if len(floatingIP) > 0 {
if floatingIP != "" {
networkingClient, err := config.networkingV2Client(d.Get("region").(string))
if err != nil {
return fmt.Errorf("Error creating OpenStack compute client: %s", err)

View File

@ -84,6 +84,6 @@ func testAccCheckNetworkingV2FloatingIPExists(t *testing.T, n string, kp *floati
var testAccNetworkingV2FloatingIP_basic = fmt.Sprintf(`
resource "openstack_networking_floatingip_v2" "foo" {
region = "%s"
pool = "PublicNetwork-01"
pool = "%s"
}`,
OS_REGION_NAME)
OS_REGION_NAME, OS_POOL_NAME)