From 3b75cac958ce8a413b617da64fa332e463dc9d98 Mon Sep 17 00:00:00 2001 From: justinsb Date: Tue, 2 Apr 2024 10:35:10 -0400 Subject: [PATCH] mockgcp: fix monitoring to use environment Fixing some rebase issues. --- mockgcp/mockmonitoring/dashboard.go | 2 +- mockgcp/mockmonitoring/service.go | 15 +++++---------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/mockgcp/mockmonitoring/dashboard.go b/mockgcp/mockmonitoring/dashboard.go index f7994a5efb..813ee39be2 100644 --- a/mockgcp/mockmonitoring/dashboard.go +++ b/mockgcp/mockmonitoring/dashboard.go @@ -188,7 +188,7 @@ func (s *MockService) parseDashboardName(name string) (*dashboardName, error) { tokens := strings.Split(name, "/") if len(tokens) == 4 && tokens[0] == "projects" && tokens[2] == "dashboards" { - project, err := s.projects.GetProjectByID(tokens[1]) + project, err := s.Projects.GetProjectByID(tokens[1]) if err != nil { return nil, err } diff --git a/mockgcp/mockmonitoring/service.go b/mockgcp/mockmonitoring/service.go index 9c53ca9008..6f91da4046 100644 --- a/mockgcp/mockmonitoring/service.go +++ b/mockgcp/mockmonitoring/service.go @@ -21,20 +21,16 @@ import ( "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/common" "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/common/httpmux" "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/common/operations" - "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/common/projects" "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/pkg/storage" "google.golang.org/grpc" - "sigs.k8s.io/controller-runtime/pkg/client" pb "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/generated/mockgcp/monitoring/dashboard/v1" ) // MockService represents a mocked apikeys service. type MockService struct { - kube client.Client - storage storage.Storage - - projects projects.ProjectStore + *common.MockEnvironment + storage storage.Storage operations *operations.Operations } @@ -46,10 +42,9 @@ type DashboardsService struct { // New creates a MockService. func New(env *common.MockEnvironment, storage storage.Storage) *MockService { s := &MockService{ - kube: env.GetKubeClient(), - storage: storage, - projects: env.GetProjects(), - operations: operations.NewOperationsService(storage), + MockEnvironment: env, + storage: storage, + operations: operations.NewOperationsService(storage), } return s }