Skip to content

Commit

Permalink
Make pool name configurable in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
julienvey committed Feb 9, 2015
1 parent 21549b7 commit 7d75f10
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
7 changes: 7 additions & 0 deletions builtin/providers/openstack/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

var (
OS_REGION_NAME = ""
OS_POOL_NAME = ""
)

var testAccProviders map[string]terraform.ResourceProvider
Expand Down Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 7d75f10

Please sign in to comment.