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{
|
||||
Type: schema.TypeInt,
|
||||
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,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
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(`
|
||||
resource "cloudstack_vpc" "foo" {
|
||||
name = "terraform-vpc"
|
||||
display_text = "terraform-vpc-text"
|
||||
name = "terraform-vpc-foo"
|
||||
cidr = "%s"
|
||||
vpc_offering = "%s"
|
||||
zone = "%s"
|
||||
}
|
||||
|
||||
resource "cloudstack_vpc" "bar" {
|
||||
name = "terraform-vpc"
|
||||
display_text = "terraform-vpc-text"
|
||||
name = "terraform-vpc-bar"
|
||||
cidr = "%s"
|
||||
vpc_offering = "%s"
|
||||
zone = "%s"
|
||||
|
@ -111,7 +111,7 @@ resource "cloudstack_vpn_customer_gateway" "foo" {
|
|||
name = "terraform-foo"
|
||||
cidr = "${cloudstack_vpc.foo.cidr}"
|
||||
esp_policy = "aes256-sha1"
|
||||
gateway = "${cloudstack_vpn_gateway.foo.publicip}"
|
||||
gateway = "${cloudstack_vpn_gateway.foo.public_ip}"
|
||||
ike_policy = "aes256-sha1"
|
||||
ipsec_psk = "terraform"
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ resource "cloudstack_vpn_customer_gateway" "bar" {
|
|||
name = "terraform-bar"
|
||||
cidr = "${cloudstack_vpc.bar.cidr}"
|
||||
esp_policy = "aes256-sha1"
|
||||
gateway = "${cloudstack_vpn_gateway.bar.publicip}"
|
||||
gateway = "${cloudstack_vpn_gateway.bar.public_ip}"
|
||||
ike_policy = "aes256-sha1"
|
||||
ipsec_psk = "terraform"
|
||||
}
|
||||
|
|
|
@ -21,16 +21,16 @@ func TestAccCloudStackVPNCustomerGateway_basic(t *testing.T) {
|
|||
Config: testAccCloudStackVPNCustomerGateway_basic,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckCloudStackVPNCustomerGatewayExists(
|
||||
"cloudstack_vpn_connection.foo", &vpnCustomerGateway),
|
||||
"cloudstack_vpn_customer_gateway.foo", &vpnCustomerGateway),
|
||||
testAccCheckCloudStackVPNCustomerGatewayAttributes(&vpnCustomerGateway),
|
||||
resource.TestCheckResourceAttr(
|
||||
"cloudstack_vpn_connection.foo", "name", "terraform-foo"),
|
||||
"cloudstack_vpn_customer_gateway.foo", "name", "terraform-foo"),
|
||||
resource.TestCheckResourceAttr(
|
||||
"cloudstack_vpn_connection.bar", "name", "terraform-bar"),
|
||||
"cloudstack_vpn_customer_gateway.bar", "name", "terraform-bar"),
|
||||
resource.TestCheckResourceAttr(
|
||||
"cloudstack_vpn_connection.foo", "ike_policy", "aes256-sha1"),
|
||||
"cloudstack_vpn_customer_gateway.foo", "ike_policy", "aes256-sha1"),
|
||||
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) {
|
||||
var nic cloudstack.Nic
|
||||
var vpnCustomerGateway cloudstack.VpnCustomerGateway
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckCloudStackNICDestroy,
|
||||
CheckDestroy: testAccCheckCloudStackVPNCustomerGatewayDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
resource.TestStep{
|
||||
Config: TestAccCloudStackVPNCustomerGateway_basic,
|
||||
Config: testAccCloudStackVPNCustomerGateway_basic,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckCloudStackVPNCustomerGatewayExists(
|
||||
"cloudstack_vpn_connection.foo", &vpnCustomerGateway),
|
||||
"cloudstack_vpn_customer_gateway.foo", &vpnCustomerGateway),
|
||||
testAccCheckCloudStackVPNCustomerGatewayAttributes(&vpnCustomerGateway),
|
||||
resource.TestCheckResourceAttr(
|
||||
"cloudstack_vpn_connection.foo", "name", "terraform-foo"),
|
||||
"cloudstack_vpn_customer_gateway.foo", "name", "terraform-foo"),
|
||||
resource.TestCheckResourceAttr(
|
||||
"cloudstack_vpn_connection.bar", "name", "terraform-bar"),
|
||||
"cloudstack_vpn_customer_gateway.bar", "name", "terraform-bar"),
|
||||
resource.TestCheckResourceAttr(
|
||||
"cloudstack_vpn_connection.foo", "ike_policy", "aes256-sha1"),
|
||||
"cloudstack_vpn_customer_gateway.foo", "ike_policy", "aes256-sha1"),
|
||||
resource.TestCheckResourceAttr(
|
||||
"cloudstack_vpn_connection.bar", "esp_policy", "aes256-sha1"),
|
||||
"cloudstack_vpn_customer_gateway.bar", "esp_policy", "aes256-sha1"),
|
||||
),
|
||||
},
|
||||
|
||||
resource.TestStep{
|
||||
Config: TestAccCloudStackVPNCustomerGateway_update,
|
||||
Config: testAccCloudStackVPNCustomerGateway_update,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckCloudStackVPNCustomerGatewayExists(
|
||||
"cloudstack_vpn_connection.foo", &vpnCustomerGateway),
|
||||
"cloudstack_vpn_customer_gateway.foo", &vpnCustomerGateway),
|
||||
testAccCheckCloudStackVPNCustomerGatewayAttributes(&vpnCustomerGateway),
|
||||
resource.TestCheckResourceAttr(
|
||||
"cloudstack_vpn_connection.foo", "name", "terraform-foo-bar"),
|
||||
"cloudstack_vpn_customer_gateway.foo", "name", "terraform-foo-bar"),
|
||||
resource.TestCheckResourceAttr(
|
||||
"cloudstack_vpn_connection.bar", "name", "terraform-bar-foo"),
|
||||
"cloudstack_vpn_customer_gateway.bar", "name", "terraform-bar-foo"),
|
||||
resource.TestCheckResourceAttr(
|
||||
"cloudstack_vpn_connection.foo", "ike_policy", "3des-md5"),
|
||||
"cloudstack_vpn_customer_gateway.foo", "ike_policy", "3des-md5"),
|
||||
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)
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "cloudstack_vpn_connection" {
|
||||
if rs.Type != "cloudstack_vpn_customer_gateway" {
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -158,16 +158,14 @@ func testAccCheckCloudStackVPNCustomerGatewayDestroy(s *terraform.State) error {
|
|||
|
||||
var testAccCloudStackVPNCustomerGateway_basic = fmt.Sprintf(`
|
||||
resource "cloudstack_vpc" "foo" {
|
||||
name = "terraform-vpc"
|
||||
display_text = "terraform-vpc-text"
|
||||
name = "terraform-vpc-foo"
|
||||
cidr = "%s"
|
||||
vpc_offering = "%s"
|
||||
zone = "%s"
|
||||
}
|
||||
|
||||
resource "cloudstack_vpc" "bar" {
|
||||
name = "terraform-vpc"
|
||||
display_text = "terraform-vpc-text"
|
||||
name = "terraform-vpc-bar"
|
||||
cidr = "%s"
|
||||
vpc_offering = "%s"
|
||||
zone = "%s"
|
||||
|
@ -185,7 +183,7 @@ resource "cloudstack_vpn_customer_gateway" "foo" {
|
|||
name = "terraform-foo"
|
||||
cidr = "${cloudstack_vpc.foo.cidr}"
|
||||
esp_policy = "aes256-sha1"
|
||||
gateway = "${cloudstack_vpn_gateway.foo.publicip}"
|
||||
gateway = "${cloudstack_vpn_gateway.foo.public_ip}"
|
||||
ike_policy = "aes256-sha1"
|
||||
ipsec_psk = "terraform"
|
||||
}
|
||||
|
@ -194,7 +192,7 @@ resource "cloudstack_vpn_customer_gateway" "bar" {
|
|||
name = "terraform-bar"
|
||||
cidr = "${cloudstack_vpc.bar.cidr}"
|
||||
esp_policy = "aes256-sha1"
|
||||
gateway = "${cloudstack_vpn_gateway.bar.publicip}"
|
||||
gateway = "${cloudstack_vpn_gateway.bar.public_ip}"
|
||||
ike_policy = "aes256-sha1"
|
||||
ipsec_psk = "terraform"
|
||||
}`,
|
||||
|
@ -210,7 +208,7 @@ resource "cloudstack_vpn_customer_gateway" "foo" {
|
|||
name = "terraform-foo-bar"
|
||||
cidr = "${cloudstack_vpc.foo.cidr}"
|
||||
esp_policy = "3des-md5"
|
||||
gateway = "${cloudstack_vpn_gateway.foo.publicip}"
|
||||
gateway = "${cloudstack_vpn_gateway.foo.public_ip}"
|
||||
ike_policy = "3des-md5"
|
||||
ipsec_psk = "terraform"
|
||||
}
|
||||
|
@ -219,7 +217,7 @@ resource "cloudstack_vpn_customer_gateway" "bar" {
|
|||
name = "terraform-bar-foo"
|
||||
cidr = "${cloudstack_vpc.bar.cidr}"
|
||||
esp_policy = "3des-md5"
|
||||
gateway = "${cloudstack_vpn_gateway.bar.publicip}"
|
||||
gateway = "${cloudstack_vpn_gateway.bar.public_ip}"
|
||||
ike_policy = "3des-md5"
|
||||
ipsec_psk = "terraform"
|
||||
}`)
|
||||
|
|
Loading…
Reference in New Issue