Skip to content

Commit c1f36d6

Browse files
authored
Fix issue with wrong filtering of vpc_subnet (#142)
Fix issue with wrong filtering of `vpc_subnet` === RUN TestSubnetList helpers.go:206: Attempting to create vpc: acc-vpc-bUB helpers.go:210: Created vpc: 23f26b51-88df-4fb8-8f3f-0b264346cf58 helpers.go:139: Attempting to create subnet: acc-subnet-2Jg helpers.go:145: Waitting for subnet 0d7fcab7-0760-44bd-80dc-dd825a45f5df to be active helpers.go:148: Created subnet: 0d7fcab7-0760-44bd-80dc-dd825a45f5df helpers.go:154: Attempting to delete subnet: 0d7fcab7-0760-44bd-80dc-dd825a45f5df helpers.go:159: Waiting for subnet 0d7fcab7-0760-44bd-80dc-dd825a45f5df to be deleted helpers.go:163: Deleted subnet: 0d7fcab7-0760-44bd-80dc-dd825a45f5df helpers.go:216: Attempting to delete vpc: 23f26b51-88df-4fb8-8f3f-0b264346cf58 helpers.go:221: Deleted vpc: 23f26b51-88df-4fb8-8f3f-0b264346cf58 --- PASS: TestSubnetList (19.58s) === RUN TestSubnetsLifecycle helpers.go:206: Attempting to create vpc: acc-vpc-23w helpers.go:210: Created vpc: 03d31ee4-fbab-4b38-8238-3ef3b0648fff helpers.go:139: Attempting to create subnet: acc-subnet-iDs helpers.go:145: Waitting for subnet b288e32e-0d80-433f-9fc7-2c4ffcbd6eeb to be active helpers.go:148: Created subnet: b288e32e-0d80-433f-9fc7-2c4ffcbd6eeb subnet_test.go:47: Attempting to update name of subnet to acc-subnet-sR4 helpers.go:154: Attempting to delete subnet: b288e32e-0d80-433f-9fc7-2c4ffcbd6eeb helpers.go:159: Waiting for subnet b288e32e-0d80-433f-9fc7-2c4ffcbd6eeb to be deleted helpers.go:163: Deleted subnet: b288e32e-0d80-433f-9fc7-2c4ffcbd6eeb helpers.go:216: Attempting to delete vpc: 03d31ee4-fbab-4b38-8238-3ef3b0648fff helpers.go:221: Deleted vpc: 03d31ee4-fbab-4b38-8238-3ef3b0648fff --- PASS: TestSubnetsLifecycle (20.85s) PASS Process finished with the exit code 0 Reviewed-by: Anton Sidelnikov <None> Reviewed-by: Anton Kachurin <katchuring@gmail.com> Reviewed-by: None <None>
1 parent d7b2355 commit c1f36d6

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

acceptance/openstack/networking/v1/subnet_test.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,20 @@ func TestSubnetList(t *testing.T) {
1313
client, err := clients.NewNetworkV1Client()
1414
th.AssertNoErr(t, err)
1515

16-
allPages, err := subnets.List(client, subnets.ListOpts{})
17-
th.AssertNoErr(t, err)
16+
vpc := createVpc(t, client)
17+
defer deleteVpc(t, client, vpc.ID)
1818

19-
tools.PrintResource(t, allPages)
19+
subnet := createSubnet(t, client, vpc.ID)
20+
defer deleteSubnet(t, client, subnet.VpcID, subnet.ID)
21+
22+
listOpts := subnets.ListOpts{
23+
VpcID: vpc.ID,
24+
}
25+
26+
filteredSubnets, err := subnets.List(client, listOpts)
27+
th.AssertNoErr(t, err)
28+
th.AssertEquals(t, 1, len(filteredSubnets))
29+
th.AssertEquals(t, vpc.ID, filteredSubnets[0].VpcID)
2030
}
2131

2232
func TestSubnetsLifecycle(t *testing.T) {

openstack/networking/v1/subnets/requests.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,32 @@ import (
1515
// either `asc' or `desc'. Marker and Limit are used for pagination.
1616
type ListOpts struct {
1717
// ID is the unique identifier for the subnet.
18-
ID string `json:"id,omitempty"`
18+
ID string `json:",omitempty"`
1919

2020
// Name is the human readable name for the subnet. It does not have to be
2121
// unique.
22-
Name string `json:"name,omitempty"`
22+
Name string `json:",omitempty"`
2323

2424
// Specifies the network segment on which the subnet resides.
25-
CIDR string `json:"cidr,omitempty"`
25+
CIDR string `json:",omitempty"`
2626

2727
// Status indicates whether or not a subnet is currently operational.
28-
Status string `json:"status,omitempty"`
28+
Status string `json:",omitempty"`
2929

3030
// Specifies the gateway of the subnet.
31-
GatewayIP string `json:"gateway_ip,omitempty"`
31+
GatewayIP string `json:",omitempty"`
3232

3333
// Specifies the IP address of DNS server 1 on the subnet.
34-
PrimaryDNS string `json:"primary_dns,omitempty"`
34+
PrimaryDNS string `json:",omitempty"`
3535

3636
// Specifies the IP address of DNS server 2 on the subnet.
37-
SecondaryDNS string `json:"secondary_dns,omitempty"`
37+
SecondaryDNS string `json:",omitempty"`
3838

3939
// Identifies the availability zone (AZ) to which the subnet belongs.
40-
AvailabilityZone string `json:"availability_zone,omitempty"`
40+
AvailabilityZone string `json:",omitempty"`
4141

4242
// Specifies the ID of the VPC to which the subnet belongs.
43-
VpcID string `json:"vpc_id,omitempty"`
43+
VpcID string `json:",omitempty"`
4444
}
4545

4646
// List returns collection of

0 commit comments

Comments
 (0)