Skip to content

Commit

Permalink
gofumpt & fix e2e
Browse files Browse the repository at this point in the history
The additional VIPs should not be created before the load balancer,
Octavia already takes care of creating the port for us.
  • Loading branch information
EmilienM committed Jan 16, 2024
1 parent b25d38a commit 49bd786
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ func TestLoadbalancersCRUD(t *testing.T) {
th.AssertNoErr(t, err)

// Create QoS policy first as the loadbalancer and its port
//needs to be deleted before the QoS policy can be deleted
// needs to be deleted before the QoS policy can be deleted
policy2, err := policies.CreateQoSPolicy(t, netClient)
th.AssertNoErr(t, err)
defer policies.DeleteQoSPolicy(t, netClient, policy2.ID)
Expand All @@ -270,21 +270,18 @@ func TestLoadbalancersCRUD(t *testing.T) {
th.AssertNoErr(t, err)
defer networking.DeleteSubnet(t, netClient, additionalSubnet.ID)

additionalSubnetPort, err := networking.CreatePort(t, netClient, network.ID, additionalSubnet.ID)
th.AssertNoErr(t, err)
defer networking.DeletePort(t, netClient, additionalSubnetPort.ID)

policy1, err := policies.CreateQoSPolicy(t, netClient)
th.AssertNoErr(t, err)
defer policies.DeleteQoSPolicy(t, netClient, policy1.ID)

tags := []string{"test"}
lb, err := CreateLoadBalancer(t, lbClient, subnet.ID, tags, policy1.ID, []loadbalancers.AdditionalVip{{SubnetID: additionalSubnet.ID, IPAddress: additionalSubnetPort.FixedIPs[0].IPAddress}})
// Octavia takes care of creating the port for the loadbalancer
additionalSubnetIP := "192.168.2.207"
lb, err := CreateLoadBalancer(t, lbClient, subnet.ID, tags, policy1.ID, []loadbalancers.AdditionalVip{{SubnetID: additionalSubnet.ID, IPAddress: additionalSubnetIP}})
th.AssertNoErr(t, err)
th.AssertEquals(t, lb.VipQosPolicyID, policy1.ID)
th.AssertEquals(t, 1, len(lb.AdditionalVips))
th.AssertEquals(t, additionalSubnetPort.FixedIPs[0].IPAddress, lb.AdditionalVips[0].IPAddress)
th.AssertEquals(t, additionalSubnetPort.FixedIPs[0].SubnetID, lb.AdditionalVips[0].SubnetID)
th.AssertEquals(t, additionalSubnetIP, lb.AdditionalVips[0].IPAddress)
defer DeleteLoadBalancer(t, lbClient, lb.ID)

lbDescription := ""
Expand Down
2 changes: 1 addition & 1 deletion internal/acceptance/openstack/networking/v2/networking.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ func CreateSubnetWithDefaultGateway(t *testing.T, client *gophercloud.ServiceCli
// specified Network ID. An error will be returned if the subnet could not be
// created.
func CreateSubnetWithNoGateway(t *testing.T, client *gophercloud.ServiceClient, networkID string) (*subnets.Subnet, error) {
var noGateway = ""
noGateway := ""
subnetName := tools.RandomString("TESTACC-", 8)
subnetOctet := tools.RandomInt(1, 250)
subnetCIDR := fmt.Sprintf("192.168.%d.0/24", subnetOctet)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,10 @@ const GetLoadbalancerStatsBody = `
}
`

var createdTime, _ = time.Parse(time.RFC3339, "2019-06-30T04:15:37Z")
var updatedTime, _ = time.Parse(time.RFC3339, "2019-06-30T05:18:49Z")
var (
createdTime, _ = time.Parse(time.RFC3339, "2019-06-30T04:15:37Z")
updatedTime, _ = time.Parse(time.RFC3339, "2019-06-30T05:18:49Z")
)

var (
LoadbalancerWeb = loadbalancers.LoadBalancer{
Expand Down Expand Up @@ -294,7 +296,8 @@ var (
SubnetID: "0d4f6a08-60b7-44ab-8903-f7d76ec54095",
IPAddress: "192.168.10.10",
},
}}
},
}
LoadbalancerUpdated = loadbalancers.LoadBalancer{
ID: "36e08a3e-a78f-4b40-a229-1e7e23eee1ab",
ProjectID: "54030507-44f7-473c-9342-b4d14a95f692",
Expand Down

0 comments on commit 49bd786

Please sign in to comment.