From ef71b7776005ee8c98a8669112b48b2b1a34171f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edu=20G=C3=B3mez=20Escandell?= Date: Wed, 15 Nov 2023 08:34:53 +0100 Subject: [PATCH] Adapt UI proservice to new FetchMicrosoftStore signature --- windows-agent/internal/proservices/ui/ui.go | 3 ++- windows-agent/internal/proservices/ui/ui_test.go | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/windows-agent/internal/proservices/ui/ui.go b/windows-agent/internal/proservices/ui/ui.go index 7a032f7a1..e5dfddd79 100644 --- a/windows-agent/internal/proservices/ui/ui.go +++ b/windows-agent/internal/proservices/ui/ui.go @@ -9,6 +9,7 @@ import ( agentapi "github.com/canonical/ubuntu-pro-for-windows/agentapi/go" "github.com/canonical/ubuntu-pro-for-windows/common" "github.com/canonical/ubuntu-pro-for-windows/windows-agent/internal/config" + "github.com/canonical/ubuntu-pro-for-windows/windows-agent/internal/contracts" "github.com/canonical/ubuntu-pro-for-windows/windows-agent/internal/distros/database" log "github.com/canonical/ubuntu-pro-for-windows/windows-agent/internal/grpc/logstreamer" "github.com/canonical/ubuntu-pro-for-windows/windows-agent/internal/tasks" @@ -19,7 +20,7 @@ type Config interface { SetUserSubscription(ctx context.Context, token string) error IsReadOnly() (bool, error) Subscription(context.Context) (string, config.Source, error) - FetchMicrosoftStoreSubscription(context.Context) error + FetchMicrosoftStoreSubscription(context.Context, ...contracts.Option) error } // Service it the UI GRPC service implementation. diff --git a/windows-agent/internal/proservices/ui/ui_test.go b/windows-agent/internal/proservices/ui/ui_test.go index 7f591006d..ca841151f 100644 --- a/windows-agent/internal/proservices/ui/ui_test.go +++ b/windows-agent/internal/proservices/ui/ui_test.go @@ -12,6 +12,7 @@ import ( "github.com/canonical/ubuntu-pro-for-windows/common/wsltestutils" "github.com/canonical/ubuntu-pro-for-windows/windows-agent/internal/config" "github.com/canonical/ubuntu-pro-for-windows/windows-agent/internal/config/registry" + "github.com/canonical/ubuntu-pro-for-windows/windows-agent/internal/contracts" "github.com/canonical/ubuntu-pro-for-windows/windows-agent/internal/distros/database" "github.com/canonical/ubuntu-pro-for-windows/windows-agent/internal/distros/distro" "github.com/canonical/ubuntu-pro-for-windows/windows-agent/internal/proservices/ui" @@ -244,7 +245,11 @@ func (m mockConfig) Subscription(context.Context) (string, config.Source, error) } return m.token, m.source, nil } -func (m *mockConfig) FetchMicrosoftStoreSubscription(ctx context.Context) error { +func (m *mockConfig) FetchMicrosoftStoreSubscription(ctx context.Context, args ...contracts.Option) error { + if len(args) != 0 { + panic("The variadic argument exists solely to match the interface. Do not use.") + } + readOnly, err := m.IsReadOnly() if err != nil { return err