Fixing up the tests to make them pass correctly
This commit is contained in:
parent
bb88adb5a3
commit
94608fc4bc
|
@ -30,7 +30,7 @@ func Provider() terraform.ResourceProvider {
|
||||||
"timeout": &schema.Schema{
|
"timeout": &schema.Schema{
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Required: true,
|
Required: true,
|
||||||
DefaultFunc: schema.EnvDefaultFunc("CLOUDSTACK_TIMEOUT", 180),
|
DefaultFunc: schema.EnvDefaultFunc("CLOUDSTACK_TIMEOUT", 300),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,9 @@ func TestAccCloudStackVPNConnection_basic(t *testing.T) {
|
||||||
Config: testAccCloudStackVPNConnection_basic,
|
Config: testAccCloudStackVPNConnection_basic,
|
||||||
Check: resource.ComposeTestCheckFunc(
|
Check: resource.ComposeTestCheckFunc(
|
||||||
testAccCheckCloudStackVPNConnectionExists(
|
testAccCheckCloudStackVPNConnectionExists(
|
||||||
"cloudstack_vpn_connection.foo", &vpnConnection),
|
"cloudstack_vpn_connection.foo-bar", &vpnConnection),
|
||||||
|
testAccCheckCloudStackVPNConnectionExists(
|
||||||
|
"cloudstack_vpn_connection.bar-foo", &vpnConnection),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -84,16 +86,14 @@ func testAccCheckCloudStackVPNConnectionDestroy(s *terraform.State) error {
|
||||||
|
|
||||||
var testAccCloudStackVPNConnection_basic = fmt.Sprintf(`
|
var testAccCloudStackVPNConnection_basic = fmt.Sprintf(`
|
||||||
resource "cloudstack_vpc" "foo" {
|
resource "cloudstack_vpc" "foo" {
|
||||||
name = "terraform-vpc"
|
name = "terraform-vpc-foo"
|
||||||
display_text = "terraform-vpc-text"
|
|
||||||
cidr = "%s"
|
cidr = "%s"
|
||||||
vpc_offering = "%s"
|
vpc_offering = "%s"
|
||||||
zone = "%s"
|
zone = "%s"
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "cloudstack_vpc" "bar" {
|
resource "cloudstack_vpc" "bar" {
|
||||||
name = "terraform-vpc"
|
name = "terraform-vpc-bar"
|
||||||
display_text = "terraform-vpc-text"
|
|
||||||
cidr = "%s"
|
cidr = "%s"
|
||||||
vpc_offering = "%s"
|
vpc_offering = "%s"
|
||||||
zone = "%s"
|
zone = "%s"
|
||||||
|
@ -111,7 +111,7 @@ resource "cloudstack_vpn_customer_gateway" "foo" {
|
||||||
name = "terraform-foo"
|
name = "terraform-foo"
|
||||||
cidr = "${cloudstack_vpc.foo.cidr}"
|
cidr = "${cloudstack_vpc.foo.cidr}"
|
||||||
esp_policy = "aes256-sha1"
|
esp_policy = "aes256-sha1"
|
||||||
gateway = "${cloudstack_vpn_gateway.foo.publicip}"
|
gateway = "${cloudstack_vpn_gateway.foo.public_ip}"
|
||||||
ike_policy = "aes256-sha1"
|
ike_policy = "aes256-sha1"
|
||||||
ipsec_psk = "terraform"
|
ipsec_psk = "terraform"
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ resource "cloudstack_vpn_customer_gateway" "bar" {
|
||||||
name = "terraform-bar"
|
name = "terraform-bar"
|
||||||
cidr = "${cloudstack_vpc.bar.cidr}"
|
cidr = "${cloudstack_vpc.bar.cidr}"
|
||||||
esp_policy = "aes256-sha1"
|
esp_policy = "aes256-sha1"
|
||||||
gateway = "${cloudstack_vpn_gateway.bar.publicip}"
|
gateway = "${cloudstack_vpn_gateway.bar.public_ip}"
|
||||||
ike_policy = "aes256-sha1"
|
ike_policy = "aes256-sha1"
|
||||||
ipsec_psk = "terraform"
|
ipsec_psk = "terraform"
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,16 +21,16 @@ func TestAccCloudStackVPNCustomerGateway_basic(t *testing.T) {
|
||||||
Config: testAccCloudStackVPNCustomerGateway_basic,
|
Config: testAccCloudStackVPNCustomerGateway_basic,
|
||||||
Check: resource.ComposeTestCheckFunc(
|
Check: resource.ComposeTestCheckFunc(
|
||||||
testAccCheckCloudStackVPNCustomerGatewayExists(
|
testAccCheckCloudStackVPNCustomerGatewayExists(
|
||||||
"cloudstack_vpn_connection.foo", &vpnCustomerGateway),
|
"cloudstack_vpn_customer_gateway.foo", &vpnCustomerGateway),
|
||||||
testAccCheckCloudStackVPNCustomerGatewayAttributes(&vpnCustomerGateway),
|
testAccCheckCloudStackVPNCustomerGatewayAttributes(&vpnCustomerGateway),
|
||||||
resource.TestCheckResourceAttr(
|
resource.TestCheckResourceAttr(
|
||||||
"cloudstack_vpn_connection.foo", "name", "terraform-foo"),
|
"cloudstack_vpn_customer_gateway.foo", "name", "terraform-foo"),
|
||||||
resource.TestCheckResourceAttr(
|
resource.TestCheckResourceAttr(
|
||||||
"cloudstack_vpn_connection.bar", "name", "terraform-bar"),
|
"cloudstack_vpn_customer_gateway.bar", "name", "terraform-bar"),
|
||||||
resource.TestCheckResourceAttr(
|
resource.TestCheckResourceAttr(
|
||||||
"cloudstack_vpn_connection.foo", "ike_policy", "aes256-sha1"),
|
"cloudstack_vpn_customer_gateway.foo", "ike_policy", "aes256-sha1"),
|
||||||
resource.TestCheckResourceAttr(
|
resource.TestCheckResourceAttr(
|
||||||
"cloudstack_vpn_connection.bar", "esp_policy", "aes256-sha1"),
|
"cloudstack_vpn_customer_gateway.bar", "esp_policy", "aes256-sha1"),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -38,44 +38,44 @@ func TestAccCloudStackVPNCustomerGateway_basic(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAccCloudStackVPNCustomerGateway_update(t *testing.T) {
|
func TestAccCloudStackVPNCustomerGateway_update(t *testing.T) {
|
||||||
var nic cloudstack.Nic
|
var vpnCustomerGateway cloudstack.VpnCustomerGateway
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
Providers: testAccProviders,
|
Providers: testAccProviders,
|
||||||
CheckDestroy: testAccCheckCloudStackNICDestroy,
|
CheckDestroy: testAccCheckCloudStackVPNCustomerGatewayDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
resource.TestStep{
|
resource.TestStep{
|
||||||
Config: TestAccCloudStackVPNCustomerGateway_basic,
|
Config: testAccCloudStackVPNCustomerGateway_basic,
|
||||||
Check: resource.ComposeTestCheckFunc(
|
Check: resource.ComposeTestCheckFunc(
|
||||||
testAccCheckCloudStackVPNCustomerGatewayExists(
|
testAccCheckCloudStackVPNCustomerGatewayExists(
|
||||||
"cloudstack_vpn_connection.foo", &vpnCustomerGateway),
|
"cloudstack_vpn_customer_gateway.foo", &vpnCustomerGateway),
|
||||||
testAccCheckCloudStackVPNCustomerGatewayAttributes(&vpnCustomerGateway),
|
testAccCheckCloudStackVPNCustomerGatewayAttributes(&vpnCustomerGateway),
|
||||||
resource.TestCheckResourceAttr(
|
resource.TestCheckResourceAttr(
|
||||||
"cloudstack_vpn_connection.foo", "name", "terraform-foo"),
|
"cloudstack_vpn_customer_gateway.foo", "name", "terraform-foo"),
|
||||||
resource.TestCheckResourceAttr(
|
resource.TestCheckResourceAttr(
|
||||||
"cloudstack_vpn_connection.bar", "name", "terraform-bar"),
|
"cloudstack_vpn_customer_gateway.bar", "name", "terraform-bar"),
|
||||||
resource.TestCheckResourceAttr(
|
resource.TestCheckResourceAttr(
|
||||||
"cloudstack_vpn_connection.foo", "ike_policy", "aes256-sha1"),
|
"cloudstack_vpn_customer_gateway.foo", "ike_policy", "aes256-sha1"),
|
||||||
resource.TestCheckResourceAttr(
|
resource.TestCheckResourceAttr(
|
||||||
"cloudstack_vpn_connection.bar", "esp_policy", "aes256-sha1"),
|
"cloudstack_vpn_customer_gateway.bar", "esp_policy", "aes256-sha1"),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
||||||
resource.TestStep{
|
resource.TestStep{
|
||||||
Config: TestAccCloudStackVPNCustomerGateway_update,
|
Config: testAccCloudStackVPNCustomerGateway_update,
|
||||||
Check: resource.ComposeTestCheckFunc(
|
Check: resource.ComposeTestCheckFunc(
|
||||||
testAccCheckCloudStackVPNCustomerGatewayExists(
|
testAccCheckCloudStackVPNCustomerGatewayExists(
|
||||||
"cloudstack_vpn_connection.foo", &vpnCustomerGateway),
|
"cloudstack_vpn_customer_gateway.foo", &vpnCustomerGateway),
|
||||||
testAccCheckCloudStackVPNCustomerGatewayAttributes(&vpnCustomerGateway),
|
testAccCheckCloudStackVPNCustomerGatewayAttributes(&vpnCustomerGateway),
|
||||||
resource.TestCheckResourceAttr(
|
resource.TestCheckResourceAttr(
|
||||||
"cloudstack_vpn_connection.foo", "name", "terraform-foo-bar"),
|
"cloudstack_vpn_customer_gateway.foo", "name", "terraform-foo-bar"),
|
||||||
resource.TestCheckResourceAttr(
|
resource.TestCheckResourceAttr(
|
||||||
"cloudstack_vpn_connection.bar", "name", "terraform-bar-foo"),
|
"cloudstack_vpn_customer_gateway.bar", "name", "terraform-bar-foo"),
|
||||||
resource.TestCheckResourceAttr(
|
resource.TestCheckResourceAttr(
|
||||||
"cloudstack_vpn_connection.foo", "ike_policy", "3des-md5"),
|
"cloudstack_vpn_customer_gateway.foo", "ike_policy", "3des-md5"),
|
||||||
resource.TestCheckResourceAttr(
|
resource.TestCheckResourceAttr(
|
||||||
"cloudstack_vpn_connection.bar", "esp_policy", "3des-md5"),
|
"cloudstack_vpn_customer_gateway.bar", "esp_policy", "3des-md5"),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -135,7 +135,7 @@ func testAccCheckCloudStackVPNCustomerGatewayDestroy(s *terraform.State) error {
|
||||||
cs := testAccProvider.Meta().(*cloudstack.CloudStackClient)
|
cs := testAccProvider.Meta().(*cloudstack.CloudStackClient)
|
||||||
|
|
||||||
for _, rs := range s.RootModule().Resources {
|
for _, rs := range s.RootModule().Resources {
|
||||||
if rs.Type != "cloudstack_vpn_connection" {
|
if rs.Type != "cloudstack_vpn_customer_gateway" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,16 +158,14 @@ func testAccCheckCloudStackVPNCustomerGatewayDestroy(s *terraform.State) error {
|
||||||
|
|
||||||
var testAccCloudStackVPNCustomerGateway_basic = fmt.Sprintf(`
|
var testAccCloudStackVPNCustomerGateway_basic = fmt.Sprintf(`
|
||||||
resource "cloudstack_vpc" "foo" {
|
resource "cloudstack_vpc" "foo" {
|
||||||
name = "terraform-vpc"
|
name = "terraform-vpc-foo"
|
||||||
display_text = "terraform-vpc-text"
|
|
||||||
cidr = "%s"
|
cidr = "%s"
|
||||||
vpc_offering = "%s"
|
vpc_offering = "%s"
|
||||||
zone = "%s"
|
zone = "%s"
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "cloudstack_vpc" "bar" {
|
resource "cloudstack_vpc" "bar" {
|
||||||
name = "terraform-vpc"
|
name = "terraform-vpc-bar"
|
||||||
display_text = "terraform-vpc-text"
|
|
||||||
cidr = "%s"
|
cidr = "%s"
|
||||||
vpc_offering = "%s"
|
vpc_offering = "%s"
|
||||||
zone = "%s"
|
zone = "%s"
|
||||||
|
@ -185,7 +183,7 @@ resource "cloudstack_vpn_customer_gateway" "foo" {
|
||||||
name = "terraform-foo"
|
name = "terraform-foo"
|
||||||
cidr = "${cloudstack_vpc.foo.cidr}"
|
cidr = "${cloudstack_vpc.foo.cidr}"
|
||||||
esp_policy = "aes256-sha1"
|
esp_policy = "aes256-sha1"
|
||||||
gateway = "${cloudstack_vpn_gateway.foo.publicip}"
|
gateway = "${cloudstack_vpn_gateway.foo.public_ip}"
|
||||||
ike_policy = "aes256-sha1"
|
ike_policy = "aes256-sha1"
|
||||||
ipsec_psk = "terraform"
|
ipsec_psk = "terraform"
|
||||||
}
|
}
|
||||||
|
@ -194,7 +192,7 @@ resource "cloudstack_vpn_customer_gateway" "bar" {
|
||||||
name = "terraform-bar"
|
name = "terraform-bar"
|
||||||
cidr = "${cloudstack_vpc.bar.cidr}"
|
cidr = "${cloudstack_vpc.bar.cidr}"
|
||||||
esp_policy = "aes256-sha1"
|
esp_policy = "aes256-sha1"
|
||||||
gateway = "${cloudstack_vpn_gateway.bar.publicip}"
|
gateway = "${cloudstack_vpn_gateway.bar.public_ip}"
|
||||||
ike_policy = "aes256-sha1"
|
ike_policy = "aes256-sha1"
|
||||||
ipsec_psk = "terraform"
|
ipsec_psk = "terraform"
|
||||||
}`,
|
}`,
|
||||||
|
@ -210,7 +208,7 @@ resource "cloudstack_vpn_customer_gateway" "foo" {
|
||||||
name = "terraform-foo-bar"
|
name = "terraform-foo-bar"
|
||||||
cidr = "${cloudstack_vpc.foo.cidr}"
|
cidr = "${cloudstack_vpc.foo.cidr}"
|
||||||
esp_policy = "3des-md5"
|
esp_policy = "3des-md5"
|
||||||
gateway = "${cloudstack_vpn_gateway.foo.publicip}"
|
gateway = "${cloudstack_vpn_gateway.foo.public_ip}"
|
||||||
ike_policy = "3des-md5"
|
ike_policy = "3des-md5"
|
||||||
ipsec_psk = "terraform"
|
ipsec_psk = "terraform"
|
||||||
}
|
}
|
||||||
|
@ -219,7 +217,7 @@ resource "cloudstack_vpn_customer_gateway" "bar" {
|
||||||
name = "terraform-bar-foo"
|
name = "terraform-bar-foo"
|
||||||
cidr = "${cloudstack_vpc.bar.cidr}"
|
cidr = "${cloudstack_vpc.bar.cidr}"
|
||||||
esp_policy = "3des-md5"
|
esp_policy = "3des-md5"
|
||||||
gateway = "${cloudstack_vpn_gateway.bar.publicip}"
|
gateway = "${cloudstack_vpn_gateway.bar.public_ip}"
|
||||||
ike_policy = "3des-md5"
|
ike_policy = "3des-md5"
|
||||||
ipsec_psk = "terraform"
|
ipsec_psk = "terraform"
|
||||||
}`)
|
}`)
|
||||||
|
|
Loading…
Reference in New Issue