Make pool name configurable in tests
This commit is contained in:
parent
760e03856e
commit
132d5acb33
|
@ -10,6 +10,7 @@ import (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
OS_REGION_NAME = ""
|
OS_REGION_NAME = ""
|
||||||
|
OS_POOL_NAME = ""
|
||||||
)
|
)
|
||||||
|
|
||||||
var testAccProviders map[string]terraform.ResourceProvider
|
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")
|
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")
|
v = os.Getenv("OS_FLAVOR_ID")
|
||||||
if v == "" {
|
if v == "" {
|
||||||
t.Fatal("OS_FLAVOR_ID must be set for acceptance tests")
|
t.Fatal("OS_FLAVOR_ID must be set for acceptance tests")
|
||||||
|
|
|
@ -224,7 +224,7 @@ func resourceComputeInstanceV2Create(d *schema.ResourceData, meta interface{}) e
|
||||||
server.ID, err)
|
server.ID, err)
|
||||||
}
|
}
|
||||||
floatingIP := d.Get("floating_ip").(string)
|
floatingIP := d.Get("floating_ip").(string)
|
||||||
if len(floatingIP) > 0 {
|
if floatingIP != "" {
|
||||||
networkingClient, err := config.networkingV2Client(d.Get("region").(string))
|
networkingClient, err := config.networkingV2Client(d.Get("region").(string))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Error creating OpenStack compute client: %s", err)
|
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") {
|
if d.HasChange("floating_ip") {
|
||||||
floatingIP := d.Get("floating_ip").(string)
|
floatingIP := d.Get("floating_ip").(string)
|
||||||
if len(floatingIP) > 0 {
|
if floatingIP != "" {
|
||||||
networkingClient, err := config.networkingV2Client(d.Get("region").(string))
|
networkingClient, err := config.networkingV2Client(d.Get("region").(string))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Error creating OpenStack compute client: %s", err)
|
return fmt.Errorf("Error creating OpenStack compute client: %s", err)
|
||||||
|
|
|
@ -84,6 +84,6 @@ func testAccCheckNetworkingV2FloatingIPExists(t *testing.T, n string, kp *floati
|
||||||
var testAccNetworkingV2FloatingIP_basic = fmt.Sprintf(`
|
var testAccNetworkingV2FloatingIP_basic = fmt.Sprintf(`
|
||||||
resource "openstack_networking_floatingip_v2" "foo" {
|
resource "openstack_networking_floatingip_v2" "foo" {
|
||||||
region = "%s"
|
region = "%s"
|
||||||
pool = "PublicNetwork-01"
|
pool = "%s"
|
||||||
}`,
|
}`,
|
||||||
OS_REGION_NAME)
|
OS_REGION_NAME, OS_POOL_NAME)
|
||||||
|
|
Loading…
Reference in New Issue