Skip to content

Commit 10fe626

Browse files
jsorianomrodm
andauthored
Handle fields introduced in 9.3.0 for policy tests (#3035)
Co-authored-by: Mario Rodriguez Molins <[email protected]>
1 parent 15a4cc7 commit 10fe626

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

internal/testrunner/runners/policy/policy.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,12 @@ var policyEntryFilters = []policyEntryFilter{
170170
{name: "data_stream.elasticsearch", onlyIfEmpty: true},
171171
}},
172172
}},
173+
174+
// Fields present since 9.3.0.
175+
{name: "inputs", elementsEntries: []policyEntryFilter{
176+
{name: "meta.package.policy_template"},
177+
{name: "meta.package.release"},
178+
}},
173179
}
174180

175181
var uniqueOTelComponentIDReplace = policyEntryReplace{
@@ -321,6 +327,9 @@ func cleanPolicyMap(policyMap common.MapStr, entries []policyEntryFilter) (commo
321327
return policyMap, nil
322328
}
323329

330+
// isEmpty checks if the value is empty. It is considered empty if it is the zero value,
331+
// or for values for length, if it is zero. Values in ignoreValues are not counted for
332+
// the total length when present in lists.
324333
func isEmpty(v any, ignoreValues []any) bool {
325334
switch v := v.(type) {
326335
case nil:

internal/testrunner/runners/policy/policy_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ inputs:
146146
package:
147147
name: sql_input
148148
version: 1.0.0
149+
release: ga
150+
policy_template: sql_input
149151
name: test-mysql-sql_input
150152
package_policy_id: b2775cd2-185c-11ef-bf70-b7bd5adaa788
151153
streams:

0 commit comments

Comments
 (0)