diff --git a/internal/testrunner/runners/policy/testconfig.go b/internal/testrunner/runners/policy/testconfig.go index acae9a1a74..cfddd740f4 100644 --- a/internal/testrunner/runners/policy/testconfig.go +++ b/internal/testrunner/runners/policy/testconfig.go @@ -8,7 +8,8 @@ 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" ) @@ -16,11 +17,11 @@ import ( 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) { @@ -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 diff --git a/test/packages/parallel/httpcheck/_dev/test/policy/test-skip.expected b/test/packages/parallel/httpcheck/_dev/test/policy/test-skip.expected new file mode 100644 index 0000000000..e86914b30f --- /dev/null +++ b/test/packages/parallel/httpcheck/_dev/test/policy/test-skip.expected @@ -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 diff --git a/test/packages/parallel/httpcheck/_dev/test/policy/test-skip.yml b/test/packages/parallel/httpcheck/_dev/test/policy/test-skip.yml new file mode 100644 index 0000000000..2320b17cea --- /dev/null +++ b/test/packages/parallel/httpcheck/_dev/test/policy/test-skip.yml @@ -0,0 +1,6 @@ +skip: + reason: Test skipped tests + link: https://github.com/elastic/elastic-package/pull/3299 +vars: + endpoints: + - https://epr.elastic.co