Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions internal/testrunner/runners/policy/testconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,20 @@ import (
"fmt"
"os"

"gopkg.in/yaml.v3"
"github.com/elastic/go-ucfg"
"github.com/elastic/go-ucfg/yaml"

"github.com/elastic/elastic-package/internal/testrunner"
)

type testConfig struct {
testrunner.SkippableConfig `config:",inline"`

Input string `yaml:"input,omitempty"`
Vars map[string]any `yaml:"vars,omitempty"`
Input string `config:"input,omitempty" yaml:"input,omitempty"`
Vars map[string]any `config:"vars,omitempty" yaml:"vars,omitempty"`
DataStream struct {
Vars map[string]any `yaml:"vars,omitempty"`
} `yaml:"data_stream"`
Vars map[string]any `config:"vars,omitempty" yaml:"vars,omitempty"`
} `config:"data_stream" yaml:"data_stream"`
}

func readTestConfig(testPath string) (*testConfig, error) {
Expand All @@ -30,9 +31,12 @@ func readTestConfig(testPath string) (*testConfig, error) {
}

var config testConfig
err = yaml.Unmarshal(d, &config)
cfg, err := yaml.NewConfig(d, ucfg.PathSep("."))
if err != nil {
return nil, fmt.Errorf("failed to decode config: %w", err)
return nil, fmt.Errorf("unable to load system test configuration file: %s: %w", testPath, err)
}
if err := cfg.Unpack(&config); err != nil {
return nil, fmt.Errorf("unable to unpack system test configuration file: %s: %w", testPath, err)
}

return &config, nil
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
connectors:
forward: {}
exporters:
elasticsearch/componentid-0:
endpoints:
- https://elasticsearch:9200
inputs: []
output_permissions:
default:
_elastic_agent_checks:
cluster:
- monitor
_elastic_agent_monitoring:
indices: []
uuid-for-permissions-on-related-indices:
indices:
- names:
- metrics-*-*
privileges:
- auto_configure
- create_doc
processors:
transform/componentid-0:
metric_statements:
- context: datapoint
statements:
- set(attributes["data_stream.type"], "metrics")
- set(attributes["data_stream.dataset"], "httpcheckreceiver")
- set(attributes["data_stream.namespace"], "ep")
receivers:
httpcheck/componentid-0:
collection_interval: 1m
targets:
- endpoints:
- https://epr.elastic.co
method: GET
secret_references: []
service:
pipelines:
metrics:
exporters:
- elasticsearch/componentid-0
receivers:
- forward
metrics/componentid-0:
exporters:
- forward
processors:
- transform/componentid-0
receivers:
- httpcheck/componentid-0
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
skip:
reason: Test skipped tests
link: https://github.com/elastic/elastic-package/pull/3299
vars:
endpoints:
- https://epr.elastic.co