2015-01-04 23:27:54 +01:00
|
|
|
package openstack
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/hashicorp/terraform/helper/schema"
|
|
|
|
"github.com/hashicorp/terraform/terraform"
|
|
|
|
)
|
|
|
|
|
2015-01-27 06:36:08 +01:00
|
|
|
var (
|
|
|
|
OS_REGION_NAME = ""
|
2015-02-09 13:27:30 +01:00
|
|
|
OS_POOL_NAME = ""
|
2015-01-27 06:36:08 +01:00
|
|
|
)
|
|
|
|
|
2015-01-04 23:27:54 +01:00
|
|
|
var testAccProviders map[string]terraform.ResourceProvider
|
|
|
|
var testAccProvider *schema.Provider
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
testAccProvider = Provider().(*schema.Provider)
|
|
|
|
testAccProviders = map[string]terraform.ResourceProvider{
|
|
|
|
"openstack": testAccProvider,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestProvider(t *testing.T) {
|
|
|
|
if err := Provider().(*schema.Provider).InternalValidate(); err != nil {
|
|
|
|
t.Fatalf("err: %s", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestProvider_impl(t *testing.T) {
|
|
|
|
var _ terraform.ResourceProvider = Provider()
|
|
|
|
}
|
|
|
|
|
|
|
|
func testAccPreCheck(t *testing.T) {
|
2015-01-27 06:36:08 +01:00
|
|
|
v := os.Getenv("OS_AUTH_URL")
|
|
|
|
if v == "" {
|
2015-01-04 23:27:54 +01:00
|
|
|
t.Fatal("OS_AUTH_URL must be set for acceptance tests")
|
|
|
|
}
|
|
|
|
|
2015-01-27 06:36:08 +01:00
|
|
|
v = os.Getenv("OS_REGION_NAME")
|
2015-04-11 06:11:34 +02:00
|
|
|
if v != "" {
|
|
|
|
OS_REGION_NAME = v
|
2015-01-04 23:27:54 +01:00
|
|
|
}
|
|
|
|
|
2015-02-10 06:20:23 +01:00
|
|
|
v1 := os.Getenv("OS_IMAGE_ID")
|
|
|
|
v2 := os.Getenv("OS_IMAGE_NAME")
|
|
|
|
|
2015-07-28 00:28:54 +02:00
|
|
|
if v1 == "" || v2 == "" {
|
|
|
|
t.Fatal("OS_IMAGE_ID and OS_IMAGE_NAME must be set for acceptance tests")
|
2015-01-04 23:27:54 +01:00
|
|
|
}
|
|
|
|
|
2015-02-09 13:27:30 +01:00
|
|
|
v = os.Getenv("OS_POOL_NAME")
|
|
|
|
if v == "" {
|
|
|
|
t.Fatal("OS_POOL_NAME must be set for acceptance tests")
|
|
|
|
}
|
|
|
|
OS_POOL_NAME = v
|
|
|
|
|
2015-02-11 06:24:38 +01:00
|
|
|
v1 = os.Getenv("OS_FLAVOR_ID")
|
|
|
|
v2 = os.Getenv("OS_FLAVOR_NAME")
|
|
|
|
if v1 == "" && v2 == "" {
|
|
|
|
t.Fatal("OS_FLAVOR_ID or OS_FLAVOR_NAME must be set for acceptance tests")
|
2015-01-04 23:27:54 +01:00
|
|
|
}
|
2015-04-01 04:56:24 +02:00
|
|
|
|
2015-04-01 23:39:54 +02:00
|
|
|
v = os.Getenv("OS_NETWORK_ID")
|
2015-04-01 04:56:24 +02:00
|
|
|
if v == "" {
|
2015-04-01 23:39:54 +02:00
|
|
|
t.Fatal("OS_NETWORK_ID must be set for acceptance tests")
|
2015-04-01 04:56:24 +02:00
|
|
|
}
|
2016-05-23 20:56:07 +02:00
|
|
|
|
|
|
|
v = os.Getenv("OS_EXTGW_ID")
|
|
|
|
if v == "" {
|
|
|
|
t.Fatal("OS_EXTGW_ID must be set for acceptance tests")
|
|
|
|
}
|
2015-01-04 23:27:54 +01:00
|
|
|
}
|