Skip to content

Commit

Permalink
Fixup acceptance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vishesh92 committed Mar 6, 2024
1 parent e62e4d4 commit 639e967
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 34 deletions.
5 changes: 2 additions & 3 deletions cloudstack/data_source_cloudstack_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ const testAccInstanceDataSourceConfig_basic = `
resource "cloudstack_instance" "my_instance" {
name = "server-a"
service_offering = "Small Instance"
network_id = "b9c953a0-8686-4240-b8a4-43849f7079ff"
template = "CentOS 5.5(64-bit) no GUI (KVM)"
zone = "DC"
template = "CentOS 5.6 (64-bit) no GUI (Simulator)"
zone = "Sandbox-simulator"
}
data "cloudstack_instance" "my_instance_test" {
filter {
Expand Down
4 changes: 2 additions & 2 deletions cloudstack/data_source_cloudstack_ipaddress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ func TestAccIPAddressDataSource_basic(t *testing.T) {

const testIPAddressDataSourceConfig_basic = `
resource "cloudstack_ipaddress" "ipaddress-resource" {
zone = "DC"
zone = "Sandbox-simulator"
}
data "cloudstack_ipaddress" "ipaddress-data-source"{
filter{
name = "zone_name"
value= "DC"
value= "Sandbox-simulator"
}
depends_on = [
cloudstack_ipaddress.ipaddress-resource
Expand Down
28 changes: 13 additions & 15 deletions cloudstack/data_source_cloudstack_service_offering_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (

func TestAccServiceOfferingDataSource_basic(t *testing.T) {
resourceName := "cloudstack_service_offering.service-offering-resource"
datasourceName := "cloudstack_service_offering.service-offering-data-source"
datasourceName := "data.cloudstack_service_offering.service-offering-data-source"

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Expand All @@ -45,18 +45,16 @@ func TestAccServiceOfferingDataSource_basic(t *testing.T) {
}

const testServiceOfferingDataSourceConfig_basic = `
resource "cloudstack_service_offering" "service-offering-resource"{
name = "TestServiceUpdate"
display_text = "DisplayService"
}
resource "cloudstack_service_offering" "service-offering-resource" {
name = "TestServiceUpdate"
display_text = "DisplayService"
}
data "cloudstack_service_offering" "service-offering-data-source"{
filter{
name = "name"
value="TestServiceUpdate"
}
depends_on = [
cloudstack_service_offering.service-resource
]
}
`
data "cloudstack_service_offering" "service-offering-data-source" {
filter {
name = "name"
value = "TestServiceUpdate"
}
depends_on = [cloudstack_service_offering.service-offering-resource]
}
`
35 changes: 23 additions & 12 deletions cloudstack/data_source_cloudstack_volume_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,30 @@ func TestAccVolumeDataSource_basic(t *testing.T) {
}

const testVolumeDataSourceConfig_basic = `
resource "cloudstack_disk_offering" "disk-offering" {
name = "TestDiskOffering"
display_text = "TestDiskOffering"
disk_size = 1
}
data "cloudstack_zone" "zone-data-source" {
filter {
name = "name"
value = "Sandbox-simulator"
}
}
resource "cloudstack_volume" "volume-resource"{
name = "TestVolume"
disk_offering_id = "0038adec-5e3e-47df-b4b4-77b5dc8e3338"
zone_id = "9a7002b2-09a2-44dc-a332-f2e4e7f01539"
name = "TestVolume"
disk_offering_id = "${cloudstack_disk_offering.disk-offering.id}"
zone_id = "${data.cloudstack_zone.zone-data-source.id}"
}
data "cloudstack_volume" "volume-data-source"{
filter{
name = "name"
value="TestVolume"
data "cloudstack_volume" "volume-data-source"{
filter {
name = "name"
value = "TestVolume"
}
depends_on = [
cloudstack_volume.volume-resource
]
}
`
depends_on = [cloudstack_volume.volume-resource]
}
`
2 changes: 1 addition & 1 deletion cloudstack/data_source_cloudstack_vpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ resource "cloudstack_vpc" "vpc-resource" {
name = "test-vpc"
cidr = "10.0.0.0/16"
vpc_offering = "Default VPC Offering"
zone = "DC"
zone = "Sandbox-simulator"
}
data "cloudstack_vpc" "vpc-data-source"{
Expand Down
2 changes: 1 addition & 1 deletion cloudstack/resource_cloudstack_private_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func resourceCloudStackPrivateGatewayRead(d *schema.ResourceData, meta interface
d.Set("gateway", gw.Gateway)
d.Set("ip_address", gw.Ipaddress)
d.Set("netmask", gw.Netmask)
d.Set("vlan", gw.Vlan)
d.Set("vlan", strings.Replace(gw.Vlan, "vlan://", "", -1))
d.Set("acl_id", gw.Aclid)
d.Set("vpc_id", gw.Vpcid)

Expand Down
2 changes: 2 additions & 0 deletions cloudstack/resource_cloudstack_private_gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ resource "cloudstack_vpc" "foo" {
resource "cloudstack_network_acl" "foo" {
name = "terraform-acl"
vpc_id = "${cloudstack_vpc.foo.id}"
depends_on = ["cloudstack_vpc.foo"]
}
resource "cloudstack_private_gateway" "foo" {
Expand All @@ -157,4 +158,5 @@ resource "cloudstack_private_gateway" "foo" {
vlan = "1"
vpc_id = "${cloudstack_vpc.foo.id}"
acl_id = "${cloudstack_network_acl.foo.id}"
depends_on = ["cloudstack_vpc.foo","cloudstack_network_acl.foo"]
}`

0 comments on commit 639e967

Please sign in to comment.