Skip to content

Commit

Permalink
Merge pull request #710 from nilo19/chore/test
Browse files Browse the repository at this point in the history
chore: enrich unit test for serviceOwnsFrontendIP
  • Loading branch information
k8s-ci-robot authored Jul 16, 2021
2 parents d0ee40f + 936ffbc commit 61c726d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
2 changes: 0 additions & 2 deletions pkg/provider/azure_standard.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,6 @@ func (az *Cloud) serviceOwnsFrontendIP(fip network.FrontendIPConfiguration, serv
return true, isPrimaryService, nil
}
klog.V(4).Infof("serviceOwnsFrontendIP: the public IP with ID %s is being referenced by other service with public IP address %s", *pip.ID, *pip.IPAddress)

return false, isPrimaryService, nil
}

return false, isPrimaryService, nil
Expand Down
27 changes: 27 additions & 0 deletions pkg/provider/azure_standard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1628,6 +1628,33 @@ func TestServiceOwnsFrontendIP(t *testing.T) {
},
},
},
{
desc: "serviceOwnsFrontendIP should return false if there is no public IP address in the frontend IP config",
existingPIPs: []network.PublicIPAddress{
{
ID: to.StringPtr("pip"),
PublicIPAddressPropertiesFormat: &network.PublicIPAddressPropertiesFormat{
IPAddress: to.StringPtr("4.3.2.1"),
},
},
},
fip: network.FrontendIPConfiguration{
Name: to.StringPtr("auid"),
FrontendIPConfigurationPropertiesFormat: &network.FrontendIPConfigurationPropertiesFormat{
PublicIPPrefix: &network.SubResource{
ID: to.StringPtr("pip1"),
},
},
},
service: &v1.Service{
ObjectMeta: meta.ObjectMeta{
UID: types.UID("secondary"),
},
Spec: v1.ServiceSpec{
LoadBalancerIP: "4.3.2.1",
},
},
},
{
desc: "serviceOwnsFrontendIP should detect the secondary external service",
existingPIPs: []network.PublicIPAddress{
Expand Down

0 comments on commit 61c726d

Please sign in to comment.