openstack: remove unused code

This commit is contained in:
Malte Poll 2024-02-09 17:40:15 +01:00
parent 031f69d988
commit ffb9492f70
2 changed files with 0 additions and 50 deletions

View File

@ -307,16 +307,6 @@ func (c *Cloud) getLoadBalancerHost(ctx context.Context) (string, error) {
return "", errors.New("no load balancer endpoint found")
}
// GetNetworkIDs returns the IDs of the networks the current instance is part of.
// This method is OpenStack specific.
func (c *Cloud) GetNetworkIDs(ctx context.Context) ([]string, error) {
networkIDs, err := c.imds.networkIDs(ctx)
if err != nil {
return nil, fmt.Errorf("retrieving network IDs: %w", err)
}
return networkIDs, nil
}
func (c *Cloud) getSubnetCIDR(uidTag string) (netip.Prefix, error) {
listSubnetsOpts := subnets.ListOpts{Tags: uidTag}
subnetsPage, err := c.api.ListSubnets(listSubnetsOpts).AllPages()

View File

@ -654,46 +654,6 @@ func TestGetLoadBalancerEndpoint(t *testing.T) {
}
}
func TestGetNetworkIDs(t *testing.T) {
someErr := fmt.Errorf("failed")
testCases := map[string]struct {
imds imdsAPI
want []string
wantErr bool
}{
"success": {
imds: &stubIMDSClient{
networkIDsResult: []string{"id1", "id2"},
},
want: []string{"id1", "id2"},
},
"fail to get network IDs": {
imds: &stubIMDSClient{
networkIDsErr: someErr,
},
wantErr: true,
},
}
for name, tc := range testCases {
t.Run(name, func(t *testing.T) {
assert := assert.New(t)
c := &Cloud{imds: tc.imds}
got, err := c.GetNetworkIDs(context.Background())
if tc.wantErr {
assert.Error(err)
} else {
assert.NoError(err)
assert.Equal(tc.want, got)
}
})
}
}
// newSubnetPager returns a subnet pager as we would get from a ListSubnets.
func newSubnetPager(nets []subnets.Subnet, err error) stubPager {
return stubPager{