test

package
v1.8.8 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateLogByFields

func CreateLogByFields(fields map[string]string) *protocol.Log

func CreateLogs

func CreateLogs(kvs ...string) *protocol.Log

func GetAvailableLocalAddress added in v1.4.0

func GetAvailableLocalAddress(t testing.TB) string

GetAvailableLocalAddress finds an available local port and returns an endpoint describing it. The port is available for opening when this function returns provided that there is no race by some other code to grab the same port immediately.

func GetTestConfig

func GetTestConfig(configName string) string

func LoadDefaultConfig

func LoadDefaultConfig() *pluginmanager.LogstoreConfig

func LoadMockConfig

func LoadMockConfig(project, logstore, configName, jsonStr string) *pluginmanager.LogstoreConfig

project, logstore, config, jsonStr

func PickEvent added in v1.4.0

func PickEvent(events []models.PipelineEvent, name string) models.PipelineEvent

PickEvent select one of original events by the specific event name.

func PickLogs added in v1.4.0

func PickLogs(logs []*protocol.Log, pickKey string, pickVal string) (res []*protocol.Log)

PickLogs select some of original logs to new res logs by the specific pickKey and pickVal.

func PluginStart

func PluginStart() error

func PluginStop

func PluginStop(forceFlushFlag bool) error

func ReadLogVal added in v1.4.0

func ReadLogVal(log *protocol.Log, key string) string

ReadLogVal returns the log content value for the input key, and returns empty string when not found.

Types

type MockCollector

type MockCollector struct {
	Logs    []*MockLog
	RawLogs []*protocol.Log
}

func (*MockCollector) AddData

func (c *MockCollector) AddData(
	tags map[string]string, fields map[string]string, t ...time.Time)

func (*MockCollector) AddDataArray

func (c *MockCollector) AddDataArray(
	tags map[string]string, columns []string, values []string, t ...time.Time)

func (*MockCollector) AddDataArrayWithContext added in v1.1.2

func (c *MockCollector) AddDataArrayWithContext(
	tags map[string]string, columns []string, values []string, ctx map[string]interface{}, t ...time.Time)

func (*MockCollector) AddDataWithContext added in v1.1.2

func (c *MockCollector) AddDataWithContext(
	tags map[string]string, fields map[string]string, ctx map[string]interface{}, t ...time.Time)

func (*MockCollector) AddRawLog

func (c *MockCollector) AddRawLog(log *protocol.Log)

func (*MockCollector) AddRawLogWithContext added in v1.1.2

func (c *MockCollector) AddRawLogWithContext(log *protocol.Log, ctx map[string]interface{})

type MockLog

type MockLog struct {
	Tags   map[string]string
	Fields map[string]string
}

type MockMetricCollector

type MockMetricCollector struct {
	Logs    []*protocol.Log
	Tags    map[string]string
	RawLogs []*protocol.Log
	// Benchmark switch ignore the cpu and memory performance influences when opening.
	Benchmark bool
}

func (*MockMetricCollector) AddData

func (m *MockMetricCollector) AddData(tags map[string]string, fields map[string]string, t ...time.Time)

func (*MockMetricCollector) AddDataArray

func (m *MockMetricCollector) AddDataArray(tags map[string]string, columns []string, values []string, t ...time.Time)

func (*MockMetricCollector) AddDataArrayWithContext added in v1.1.2

func (m *MockMetricCollector) AddDataArrayWithContext(tags map[string]string, columns []string, values []string, ctx map[string]interface{}, t ...time.Time)

func (*MockMetricCollector) AddDataWithContext added in v1.1.2

func (m *MockMetricCollector) AddDataWithContext(tags map[string]string, fields map[string]string, ctx map[string]interface{}, t ...time.Time)

func (*MockMetricCollector) AddRawLog

func (m *MockMetricCollector) AddRawLog(log *protocol.Log)

func (*MockMetricCollector) AddRawLogWithContext added in v1.1.2

func (m *MockMetricCollector) AddRawLogWithContext(log *protocol.Log, ctx map[string]interface{})

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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