testutils

package
v1.0.0-beta.160 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockStreamingConnector

type MockStreamingConnector struct {
	// contains filtered or unexported fields
}

func NewMockStreamingConnector

func NewMockStreamingConnector(t testing.TB) *MockStreamingConnector

func (*MockStreamingConnector) AddRow

func (m *MockStreamingConnector) AddRow(meterSlug string, row models.MeterQueryRow)

func (*MockStreamingConnector) AddSimpleEvent

func (m *MockStreamingConnector) AddSimpleEvent(meterSlug string, value float64, at time.Time)

func (*MockStreamingConnector) CountEvents

func (*MockStreamingConnector) CreateMeter

func (m *MockStreamingConnector) CreateMeter(ctx context.Context, namespace string, meter *models.Meter) error

func (*MockStreamingConnector) DeleteMeter

func (m *MockStreamingConnector) DeleteMeter(ctx context.Context, namespace string, meterSlug string) error

func (*MockStreamingConnector) ListEvents

func (m *MockStreamingConnector) ListEvents(ctx context.Context, namespace string, params streaming.ListEventsParams) ([]api.IngestedEvent, error)

func (*MockStreamingConnector) ListMeterSubjects

func (m *MockStreamingConnector) ListMeterSubjects(ctx context.Context, namespace string, meterSlug string, from *time.Time, to *time.Time) ([]string, error)

func (*MockStreamingConnector) QueryMeter

func (m *MockStreamingConnector) QueryMeter(ctx context.Context, namespace string, meterSlug string, params *streaming.QueryParams) ([]models.MeterQueryRow, error)

Returns the result query set for the given params. If the query set is not found, it will try to approximate the result by aggregating the simple events

func (*MockStreamingConnector) SetSimpleEvents

func (m *MockStreamingConnector) SetSimpleEvents(meterSlug string, fn func(events []SimpleEvent) []SimpleEvent)

type SimpleEvent

type SimpleEvent struct {
	MeterSlug string
	Value     float64
	Time      time.Time
}

Jump to

Keyboard shortcuts

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