From f0ec912ba6692cd19fc34f3e1d17b83b159da9a9 Mon Sep 17 00:00:00 2001 From: Paul Meyer Date: Wed, 25 Mar 2020 18:18:48 +0000 Subject: [PATCH] Make VirtualMachineImagesClient easier to mock --- builder/azure/common/client/azure_client_set.go | 2 +- builder/azure/common/client/platform_image.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/builder/azure/common/client/azure_client_set.go b/builder/azure/common/client/azure_client_set.go index ed98173ad..633d5f7e0 100644 --- a/builder/azure/common/client/azure_client_set.go +++ b/builder/azure/common/client/azure_client_set.go @@ -88,7 +88,7 @@ func (s azureClientSet) VirtualMachineImagesClient() VirtualMachineImagesClientA c := compute.NewVirtualMachineImagesClient(s.subscriptionID) s.configureAutorestClient(&c.Client) c.PollingDelay = s.PollingDelay - return virtualMachineImagesClientAPI{c} + return VirtualMachineImagesClient{c} } func (s azureClientSet) PollClient() autorest.Client { diff --git a/builder/azure/common/client/platform_image.go b/builder/azure/common/client/platform_image.go index 9b8afb566..2a7c0c5e1 100644 --- a/builder/azure/common/client/platform_image.go +++ b/builder/azure/common/client/platform_image.go @@ -19,9 +19,9 @@ type VirtualMachineImagesClientAPI interface { GetLatest(ctx context.Context, publisher, offer, sku, location string) (*compute.VirtualMachineImageResource, error) } -var _ VirtualMachineImagesClientAPI = virtualMachineImagesClientAPI{} +var _ VirtualMachineImagesClientAPI = VirtualMachineImagesClient{} -type virtualMachineImagesClientAPI struct { +type VirtualMachineImagesClient struct { computeapi.VirtualMachineImagesClientAPI } @@ -33,7 +33,7 @@ func ParsePlatformImageURN(urn string) (image *PlatformImage, err error) { return &PlatformImage{parts[0], parts[1], parts[2], parts[3]}, nil } -func (c virtualMachineImagesClientAPI) GetLatest(ctx context.Context, publisher, offer, sku, location string) (*compute.VirtualMachineImageResource, error) { +func (c VirtualMachineImagesClient) GetLatest(ctx context.Context, publisher, offer, sku, location string) (*compute.VirtualMachineImageResource, error) { result, err := c.List(ctx, location, publisher, offer, sku, "", to.Int32Ptr(1), "name desc") if err != nil { return nil, err