From 30c2e10c92d2dfba1434841a347671ef75457bed Mon Sep 17 00:00:00 2001 From: Sergey Smolnikov Date: Fri, 20 Sep 2024 15:26:50 +0200 Subject: [PATCH] Updated refs --- api/metrics/mock/prometheus_client_mock.go | 53 +++++++++++++++++++++ api/metrics/mock/prometheus_handler_mock.go | 52 ++++++++++++++++++++ go.mod | 2 +- go.sum | 4 +- 4 files changed, 108 insertions(+), 3 deletions(-) create mode 100644 api/metrics/mock/prometheus_client_mock.go create mode 100644 api/metrics/mock/prometheus_handler_mock.go diff --git a/api/metrics/mock/prometheus_client_mock.go b/api/metrics/mock/prometheus_client_mock.go new file mode 100644 index 00000000..b8880f2c --- /dev/null +++ b/api/metrics/mock/prometheus_client_mock.go @@ -0,0 +1,53 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: ./api/metrics/prometheus_client.go + +// Package mock is a generated GoMock package. +package mock + +import ( + context "context" + reflect "reflect" + + metrics "github.com/equinor/radix-api/api/metrics" + gomock "github.com/golang/mock/gomock" + model "github.com/prometheus/common/model" +) + +// MockPrometheusClient is a mock of PrometheusClient interface. +type MockPrometheusClient struct { + ctrl *gomock.Controller + recorder *MockPrometheusClientMockRecorder +} + +// MockPrometheusClientMockRecorder is the mock recorder for MockPrometheusClient. +type MockPrometheusClientMockRecorder struct { + mock *MockPrometheusClient +} + +// NewMockPrometheusClient creates a new mock instance. +func NewMockPrometheusClient(ctrl *gomock.Controller) *MockPrometheusClient { + mock := &MockPrometheusClient{ctrl: ctrl} + mock.recorder = &MockPrometheusClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockPrometheusClient) EXPECT() *MockPrometheusClientMockRecorder { + return m.recorder +} + +// GetMetrics mocks base method. +func (m *MockPrometheusClient) GetMetrics(ctx context.Context, appName, envName, componentName, duration, since string) (map[metrics.QueryName]model.Value, []string, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetMetrics", ctx, appName, envName, componentName, duration, since) + ret0, _ := ret[0].(map[metrics.QueryName]model.Value) + ret1, _ := ret[1].([]string) + ret2, _ := ret[2].(error) + return ret0, ret1, ret2 +} + +// GetMetrics indicates an expected call of GetMetrics. +func (mr *MockPrometheusClientMockRecorder) GetMetrics(ctx, appName, envName, componentName, duration, since interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMetrics", reflect.TypeOf((*MockPrometheusClient)(nil).GetMetrics), ctx, appName, envName, componentName, duration, since) +} diff --git a/api/metrics/mock/prometheus_handler_mock.go b/api/metrics/mock/prometheus_handler_mock.go new file mode 100644 index 00000000..a6183aa3 --- /dev/null +++ b/api/metrics/mock/prometheus_handler_mock.go @@ -0,0 +1,52 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: ./api/metrics/prometheus_handler.go + +// Package mock is a generated GoMock package. +package mock + +import ( + context "context" + reflect "reflect" + + models "github.com/equinor/radix-api/api/applications/models" + versioned "github.com/equinor/radix-operator/pkg/client/clientset/versioned" + gomock "github.com/golang/mock/gomock" +) + +// MockPrometheusHandler is a mock of PrometheusHandler interface. +type MockPrometheusHandler struct { + ctrl *gomock.Controller + recorder *MockPrometheusHandlerMockRecorder +} + +// MockPrometheusHandlerMockRecorder is the mock recorder for MockPrometheusHandler. +type MockPrometheusHandlerMockRecorder struct { + mock *MockPrometheusHandler +} + +// NewMockPrometheusHandler creates a new mock instance. +func NewMockPrometheusHandler(ctrl *gomock.Controller) *MockPrometheusHandler { + mock := &MockPrometheusHandler{ctrl: ctrl} + mock.recorder = &MockPrometheusHandlerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockPrometheusHandler) EXPECT() *MockPrometheusHandlerMockRecorder { + return m.recorder +} + +// GetUsedResources mocks base method. +func (m *MockPrometheusHandler) GetUsedResources(ctx context.Context, radixClient versioned.Interface, appName, envName, componentName, duration, since string, ignoreZero bool) (*models.UsedResources, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetUsedResources", ctx, radixClient, appName, envName, componentName, duration, since, ignoreZero) + ret0, _ := ret[0].(*models.UsedResources) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetUsedResources indicates an expected call of GetUsedResources. +func (mr *MockPrometheusHandlerMockRecorder) GetUsedResources(ctx, radixClient, appName, envName, componentName, duration, since, ignoreZero interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUsedResources", reflect.TypeOf((*MockPrometheusHandler)(nil).GetUsedResources), ctx, radixClient, appName, envName, componentName, duration, since, ignoreZero) +} diff --git a/go.mod b/go.mod index a3e2871c..53837daf 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/cert-manager/cert-manager v1.15.0 github.com/equinor/radix-common v1.9.5 github.com/equinor/radix-job-scheduler v1.11.0 - github.com/equinor/radix-operator v1.59.1 + github.com/equinor/radix-operator v1.59.3 github.com/evanphx/json-patch/v5 v5.9.0 github.com/felixge/httpsnoop v1.0.4 github.com/golang-jwt/jwt/v5 v5.2.1 diff --git a/go.sum b/go.sum index 24bc2d7b..327f2e63 100644 --- a/go.sum +++ b/go.sum @@ -87,8 +87,8 @@ github.com/equinor/radix-common v1.9.5 h1:p1xldkYUoavwIMguoxxOyVkOXLPA6K8qMsgzez github.com/equinor/radix-common v1.9.5/go.mod h1:+g0Wj0D40zz29DjNkYKVmCVeYy4OsFWKI7Qi9rA6kpY= github.com/equinor/radix-job-scheduler v1.11.0 h1:8wCmXOVl/1cto8q2WJQEE06Cw68/QmfoifYVR49vzkY= github.com/equinor/radix-job-scheduler v1.11.0/go.mod h1:yPXn3kDcMY0Z3kBkosjuefsdY1x2g0NlBeybMmHz5hc= -github.com/equinor/radix-operator v1.59.1 h1:wzb2tF4MWtGDWmyYuIv3oh17G5Bx8ztW9O+WgnI3QFc= -github.com/equinor/radix-operator v1.59.1/go.mod h1:uRW9SgVZ94hkpq87npVv2YVviRuXNJ1zgCleya1uvr8= +github.com/equinor/radix-operator v1.59.3 h1:/jCB8Av1VPSTKmkVIStXjlcGqxnSgYRtpBnD426l7Cs= +github.com/equinor/radix-operator v1.59.3/go.mod h1:uRW9SgVZ94hkpq87npVv2YVviRuXNJ1zgCleya1uvr8= github.com/evanphx/json-patch v5.9.0+incompatible h1:fBXyNpNMuTTDdquAq/uisOr2lShz4oaXpDTX2bLe7ls= github.com/evanphx/json-patch v5.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0/FOJfg=