mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-04-22 16:19:19 -04:00
openstack: remove unused code
This commit is contained in:
parent
031f69d988
commit
ffb9492f70
@ -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()
|
||||
|
@ -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{
|
||||
|
Loading…
x
Reference in New Issue
Block a user