mock_query

package
v2.0.0-...-6ed2e0c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateMeterInfoResponse

func GenerateMeterInfoResponse(meterdefinitions []v1beta1.MeterDefinition) []byte

func GetTestAPI

func GetTestAPI(trip RoundTripFunc) v1.API

Types

type FakeData

type FakeData struct {
	ResultType string
	Result     []*FakeResult
}

type FakeMetrics

type FakeMetrics struct {
	Status string
	Data   FakeData
}

type FakeResult

type FakeResult struct {
	Metric map[string]string
	Values []interface{}
}

type RoundTripFunc

type RoundTripFunc func(req *http.Request) *http.Response

RoundTripFunc is a type that represents a round trip function call for std http lib

func MockResponseRoundTripper

func MockResponseRoundTripper(file string, meterdefinitions []v1beta1.MeterDefinition) RoundTripFunc

func (RoundTripFunc) RoundTrip

func (f RoundTripFunc) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip is a wrapper function that calls an external function for mocking

type StubRoundTripper

type StubRoundTripper struct {
	StubRoundTrip RoundTripFunc
}

func (*StubRoundTripper) RoundTrip

func (s *StubRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL