config

package
v0.0.0-...-ddb5b86 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigFileName        = "ilogtail-e2e.yaml"
	DockerComposeFileName = "docker-compose.yaml"
)

The user defined configuration files.

Variables

View Source
var (
	CaseHome      string
	CaseName      string
	EngineLogFile string
	ReportFile    string
	PprofDir      string
	ProfileFlag   bool
	CoverageFile  string
	FlusherFile   string
	ConfigDir     string
	LogDir        string
)
View Source
var DemoCase = Case{
	Boot: Boot{
		Category: "docker-compose",
		Timeout:  "60s",
	},
	Ilogtail: Ilogtail{
		LoadConfigWait: "5s",
		CloseWait:      "5s",
		Config: []LogtailCfgs{
			{
				Name: "mock-metric-case",
				Content: []string{
					`{"inputs":[{"type":"metric_mock","detail":{"IntervalMs": 1000,"Tags":{"tag1":"aaaa","tag2":"bbb"},"Fields":{"content":"xxxxx","time":"2017.09.12 20:55:36"}}}]}`,
				},
			},
		},
		MountFiles: []string{},
	},
	SetUps: []SetUp{},
	Retry: Retry{
		Times:    0,
		Interval: "10s",
	},
	Verify: Verify{
		LogRules: []Rule{
			{
				Name:      "fields-check",
				Validator: "log_fields",
				Spec: map[string]interface{}{
					"expect_log_fields": []string{"tag1", "tag2", "content", "time"},
				},
			},
		},
		SystemRules: []Rule{
			{
				Name:      "counter-check",
				Validator: "sys_counter",
				Spec: map[string]interface{}{
					"expect_equal_raw_log":            true,
					"expect_equal_processed_log":      true,
					"expect_equal_flush_log":          true,
					"expect_received_minimum_log_num": 15,
				},
			},
		},
	},
	TestingInterval: "16s",
	Subscriber: Subscriber{
		Name: "grpc",
		Config: map[string]interface{}{
			"address": ":9000",
			"network": "tcp",
		},
	},
	Trigger: Trigger{
		URL:      "http://ilogtail:18689/test",
		Method:   "GET",
		Interval: "1s",
		Times:    10,
	},
	CoveragePackages: []string{
		"ilogtail/pluginmanager",
		"ilogtail/main",
	},
}

DemoCase is only for generate ilogtail-e2e-demo.yaml.

Functions

This section is empty.

Types

type Boot

type Boot struct {
	Category string `mapstructure:"category" yaml:"category"`
	Timeout  string `mapstructure:"timeout" yaml:"timeout"`
}

Boot the dependency virtual environment, such as docker compose.

type Case

type Case struct {
	Boot             Boot       `mapstructure:"boot" yaml:"boot"`
	SetUps           []SetUp    `mapstructure:"setups" yaml:"setups"`
	Ilogtail         Ilogtail   `mapstructure:"ilogtail" yaml:"ilogtail"`
	Subscriber       Subscriber `mapstructure:"subscriber" yaml:"subscriber"`
	Trigger          Trigger    `mapstructure:"trigger" yaml:"trigger"`
	Verify           Verify     `mapstructure:"verify" yaml:"verify"`
	Retry            Retry      `mapstructure:"retry" yaml:"retry"`
	TestingInterval  string     `mapstructure:"testing_interval" yaml:"testing_interval"`
	CoveragePackages []string   `mapstructure:"coverage_packages" yaml:"coverage_packages"`
}

Case declares a procedure for testing a case.

func GetDefaultCase

func GetDefaultCase() *Case

func Load

func Load(path string, profile bool) (*Case, error)

Load E2E engine config and define the global variables.

type Ilogtail

type Ilogtail struct {
	Config         []LogtailCfgs          `mapstructure:"config" yaml:"config"`
	LoadConfigWait string                 `mapstructure:"load_config_wait" yaml:"load_config_wait"`
	CloseWait      string                 `mapstructure:"close_wait" yaml:"close_wait"` // wait interval for upstream process.
	ENV            map[string]string      `mapstructure:"env" yaml:"env"`
	DependsOn      map[string]interface{} `mapstructure:"depends_on" yaml:"depends_on"`
	MountFiles     []string               `mapstructure:"mounts" yaml:"mounts"`
	Ports          []string               `mapstructure:"ports" yaml:"ports"`
}

Ilogtail is the logtail plugin configuration to load the ilogtail context.

type LogtailCfgs

type LogtailCfgs struct {
	Name      string                   `mapstructure:"name" yaml:"name"`
	MixedMode bool                     `mapstructure:"mixed_mode" yaml:"mixed_mode"`
	Detail    []map[string]interface{} `mapstructure:"detail" yaml:"detail"`
	Content   []string                 `mapstructure:"content" yaml:"content"`
}

type Retry

type Retry struct {
	Times    int    `mapstructure:"times" yaml:"times"`
	Interval string `mapstructure:"interval" yaml:"interval"`
}

Retry triggered when failing.

type Rule

type Rule struct {
	Name      string                 `mapstructure:"name" yaml:"name"`
	Validator string                 `mapstructure:"validator" yaml:"validator"`
	Spec      map[string]interface{} `mapstructure:"spec" yaml:"spec"`
}

type SetUp

type SetUp struct {
	Name    string `mapstructure:"name" yaml:"name"`
	Command string `mapstructure:"command" yaml:"command"`
}

SetUp prepares the test environment after the virtual environment started, such as installing some software.

type Subscriber

type Subscriber struct {
	Name   string                 `mapstructure:"name" yaml:"name"`
	Config map[string]interface{} `mapstructure:"config" yaml:"config"`
}

type Trigger

type Trigger struct {
	URL      string `mapstructure:"url" yaml:"url"`
	Method   string `mapstructure:"method" yaml:"method"`
	Interval string `mapstructure:"interval" yaml:"interval"`
	Times    int    `mapstructure:"times" yaml:"times"`
	Body     string `mapstructure:"body" yaml:"body"`
}

Trigger triggers the custom HTTP endpoint to create some telemetry data.

type Verify

type Verify struct {
	LogRules    []Rule `mapstructure:"log_rules" yaml:"log_rules"`
	TagRules    []Rule `mapstructure:"tag_rules" yaml:"tag_rules"`
	SystemRules []Rule `mapstructure:"system_rules" yaml:"system_rules"`
}

Verify content transferred to the mock backend to verify the collected telemetry data.

Jump to

Keyboard shortcuts

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