Skip to content

Commit

Permalink
Fixed uninstall and unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fra98 authored and cheina97 committed Oct 18, 2023
1 parent c8d1329 commit 575342b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/liqoctl/uninstall/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"

discoveryv1alpha1 "github.com/liqotech/liqo/apis/discovery/v1alpha1"
ipamv1alpha1 "github.com/liqotech/liqo/apis/ipam/v1alpha1"
netv1alpha1 "github.com/liqotech/liqo/apis/net/v1alpha1"
offv1alpha1 "github.com/liqotech/liqo/apis/offloading/v1alpha1"
sharingv1alpha1 "github.com/liqotech/liqo/apis/sharing/v1alpha1"
Expand All @@ -49,6 +50,7 @@ var liqoGroupVersions = []schema.GroupVersion{
offv1alpha1.GroupVersion,
sharingv1alpha1.GroupVersion,
virtualKubeletv1alpha1.SchemeGroupVersion,
ipamv1alpha1.GroupVersion,
}

// Options encapsulates the arguments of the uninstall command.
Expand Down
12 changes: 12 additions & 0 deletions pkg/liqonet/ipam/fake/ipam.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import (
liqonetutils "github.com/liqotech/liqo/pkg/liqonet/utils"
)

var _ ipam.IpamClient = &IPAMClient{}

// IPAMClient provides a mock implementation of the IPAMClient interface for testing purposes.
type IPAMClient struct {
localRemappedPodCIDR string
Expand Down Expand Up @@ -103,3 +105,13 @@ func (mock *IPAMClient) BelongsToPodCIDR(context.Context, *ipam.BelongsRequest,
...grpc.CallOption) (*ipam.BelongsResponse, error) {
return &ipam.BelongsResponse{Belongs: true}, nil
}

// MapNetworkCIDR mocks the corresponding IPAMClient function.
func (mock *IPAMClient) MapNetworkCIDR(_ context.Context, req *ipam.MapCIDRRequest, _ ...grpc.CallOption) (*ipam.MapCIDRResponse, error) {
return &ipam.MapCIDRResponse{Cidr: req.GetCidr()}, nil
}

// UnmapNetworkCIDR mocks the corresponding IPAMClient function.
func (mock *IPAMClient) UnmapNetworkCIDR(_ context.Context, _ *ipam.UnmapCIDRRequest, _ ...grpc.CallOption) (*ipam.UnmapCIDRResponse, error) {
return &ipam.UnmapCIDRResponse{}, nil
}

0 comments on commit 575342b

Please sign in to comment.