github.com/kubewharf/katalyst-core@v0.5.3/pkg/controller/resource-recommend/datasource/prometheus/mock_prometheus_client.go (about)

     1  /*
     2  Copyright 2022 The Katalyst Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package prometheus
    18  
    19  import (
    20  	"context"
    21  	"time"
    22  
    23  	v1 "github.com/prometheus/client_golang/api/prometheus/v1"
    24  	"github.com/prometheus/common/model"
    25  )
    26  
    27  // mockPromAPIClient is a mock implementation of v1.API for testing purposes.
    28  type mockPromAPIClient struct {
    29  	QueryRangeFunc func(ctx context.Context, query string, r v1.Range) (model.Value, v1.Warnings, error)
    30  }
    31  
    32  func (m *mockPromAPIClient) Alerts(ctx context.Context) (v1.AlertsResult, error) {
    33  	return v1.AlertsResult{}, nil
    34  }
    35  
    36  func (m *mockPromAPIClient) AlertManagers(ctx context.Context) (v1.AlertManagersResult, error) {
    37  	return v1.AlertManagersResult{}, nil
    38  }
    39  
    40  func (m *mockPromAPIClient) CleanTombstones(ctx context.Context) error {
    41  	return nil
    42  }
    43  
    44  func (m *mockPromAPIClient) Config(ctx context.Context) (v1.ConfigResult, error) {
    45  	return v1.ConfigResult{}, nil
    46  }
    47  
    48  func (m *mockPromAPIClient) DeleteSeries(ctx context.Context, matches []string, startTime time.Time, endTime time.Time) error {
    49  	return nil
    50  }
    51  
    52  func (m *mockPromAPIClient) Flags(ctx context.Context) (v1.FlagsResult, error) {
    53  	return nil, nil
    54  }
    55  
    56  func (m *mockPromAPIClient) LabelNames(ctx context.Context, matches []string, startTime time.Time, endTime time.Time) ([]string, v1.Warnings, error) {
    57  	return nil, nil, nil
    58  }
    59  
    60  func (m *mockPromAPIClient) LabelValues(ctx context.Context, label string, matches []string, startTime time.Time, endTime time.Time) (model.LabelValues, v1.Warnings, error) {
    61  	return nil, nil, nil
    62  }
    63  
    64  func (m *mockPromAPIClient) Query(ctx context.Context, query string, ts time.Time, opts ...v1.Option) (model.Value, v1.Warnings, error) {
    65  	return nil, nil, nil
    66  }
    67  
    68  func (m *mockPromAPIClient) QueryExemplars(ctx context.Context, query string, startTime time.Time, endTime time.Time) ([]v1.ExemplarQueryResult, error) {
    69  	return nil, nil
    70  }
    71  
    72  func (m *mockPromAPIClient) Buildinfo(ctx context.Context) (v1.BuildinfoResult, error) {
    73  	return v1.BuildinfoResult{}, nil
    74  }
    75  
    76  func (m *mockPromAPIClient) Runtimeinfo(ctx context.Context) (v1.RuntimeinfoResult, error) {
    77  	return v1.RuntimeinfoResult{}, nil
    78  }
    79  
    80  func (m *mockPromAPIClient) Series(ctx context.Context, matches []string, startTime time.Time, endTime time.Time) ([]model.LabelSet, v1.Warnings, error) {
    81  	return nil, nil, nil
    82  }
    83  
    84  func (m *mockPromAPIClient) Snapshot(ctx context.Context, skipHead bool) (v1.SnapshotResult, error) {
    85  	return v1.SnapshotResult{}, nil
    86  }
    87  
    88  func (m *mockPromAPIClient) Rules(ctx context.Context) (v1.RulesResult, error) {
    89  	return v1.RulesResult{}, nil
    90  }
    91  
    92  func (m *mockPromAPIClient) Targets(ctx context.Context) (v1.TargetsResult, error) {
    93  	return v1.TargetsResult{}, nil
    94  }
    95  
    96  func (m *mockPromAPIClient) TargetsMetadata(ctx context.Context, matchTarget string, metric string, limit string) ([]v1.MetricMetadata, error) {
    97  	return nil, nil
    98  }
    99  
   100  func (m *mockPromAPIClient) Metadata(ctx context.Context, metric string, limit string) (map[string][]v1.Metadata, error) {
   101  	return nil, nil
   102  }
   103  
   104  func (m *mockPromAPIClient) TSDB(ctx context.Context) (v1.TSDBResult, error) {
   105  	return v1.TSDBResult{}, nil
   106  }
   107  
   108  func (m *mockPromAPIClient) WalReplay(ctx context.Context) (v1.WalReplayStatus, error) {
   109  	return v1.WalReplayStatus{}, nil
   110  }
   111  
   112  func (m *mockPromAPIClient) QueryRange(ctx context.Context, query string, r v1.Range, opts ...v1.Option) (model.Value, v1.Warnings, error) {
   113  	return m.QueryRangeFunc(ctx, query, r)
   114  }