Skip to content

Commit

Permalink
Merge pull request GoogleCloudPlatform#1491 from justinsb/mockgcp_mon…
Browse files Browse the repository at this point in the history
…itoring_fixes

mockgcp: fix monitoring to use environment
  • Loading branch information
google-oss-prow[bot] authored Apr 2, 2024
2 parents b55b320 + 3b75cac commit 1879641
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion mockgcp/mockmonitoring/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
15 changes: 5 additions & 10 deletions mockgcp/mockmonitoring/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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
}
Expand Down

0 comments on commit 1879641

Please sign in to comment.