From fa0e46f26e2385fb5be67c07365077ea14edc980 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 30 Jul 2025 01:29:42 +0000 Subject: [PATCH 1/3] chore: [updatecli] Update default stack version to 9.1.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Made with ❤️️ by updatecli --- internal/install/stack_version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/install/stack_version.go b/internal/install/stack_version.go index eb1cc93ab6..22e60b3a74 100644 --- a/internal/install/stack_version.go +++ b/internal/install/stack_version.go @@ -6,5 +6,5 @@ package install const ( // DefaultStackVersion is the default version of the stack - DefaultStackVersion = "9.0.4" + DefaultStackVersion = "9.1.0" ) From 56c8aee453776517d91bd9d97a50dec4154f188a Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Wed, 30 Jul 2025 18:07:32 +0200 Subject: [PATCH 2/3] Ignore default namespace in policy tests --- internal/testrunner/runners/policy/policy.go | 16 ++++++++++++---- .../testrunner/runners/policy/policy_test.go | 9 +++++++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/internal/testrunner/runners/policy/policy.go b/internal/testrunner/runners/policy/policy.go index fb8274e731..e57ab4ec88 100644 --- a/internal/testrunner/runners/policy/policy.go +++ b/internal/testrunner/runners/policy/policy.go @@ -12,6 +12,7 @@ import ( "os" "path/filepath" "regexp" + "slices" "strings" "github.com/pmezard/go-difflib/difflib" @@ -98,6 +99,7 @@ type policyEntryFilter struct { elementsEntries []policyEntryFilter memberReplace *policyEntryReplace onlyIfEmpty bool + ignoreValues []any } type policyEntryReplace struct { @@ -151,7 +153,7 @@ var policyEntryFilters = []policyEntryFilter{ }}, // Namespaces may not be present in older versions of the stack. - {name: "namespaces", onlyIfEmpty: true}, + {name: "namespaces", onlyIfEmpty: true, ignoreValues: []any{"default"}}, } // cleanPolicy prepares a policy YAML as returned by the download API to be compared with other @@ -213,7 +215,7 @@ func cleanPolicyMap(policyMap common.MapStr, entries []policyEntryFilter) (commo } } default: - if entry.onlyIfEmpty && !isEmpty(v) { + if entry.onlyIfEmpty && !isEmpty(v, entry.ignoreValues) { continue } err := policyMap.Delete(entry.name) @@ -229,15 +231,21 @@ func cleanPolicyMap(policyMap common.MapStr, entries []policyEntryFilter) (commo return policyMap, nil } -func isEmpty(v any) bool { +func isEmpty(v any, ignoreValues []any) bool { switch v := v.(type) { case nil: return true case []any: - return len(v) == 0 + return len(filterIgnored(v, ignoreValues)) == 0 case map[string]any: return len(v) == 0 } return false } + +func filterIgnored(v []any, ignoredValues []any) []any { + return slices.DeleteFunc(v, func(e any) bool { + return slices.Contains(ignoredValues, e) + }) +} diff --git a/internal/testrunner/runners/policy/policy_test.go b/internal/testrunner/runners/policy/policy_test.go index 34a9bddc14..130a9a0535 100644 --- a/internal/testrunner/runners/policy/policy_test.go +++ b/internal/testrunner/runners/policy/policy_test.go @@ -64,6 +64,15 @@ id: "2e19c1c4-185b-11ef-a7fc-43855f39047f" `, found: ` namespaces: [] +`, + equal: true, + }, + { + title: "clean namespaces if default", + expected: ` +`, + found: ` +namespaces: [default] `, equal: true, }, From 20b0fcc1cb4f6367e1ea3054fe7a1f0dcaf17eb5 Mon Sep 17 00:00:00 2001 From: Jaime Soriano Pastor Date: Fri, 1 Aug 2025 16:41:52 +0200 Subject: [PATCH 3/3] Remove fields added in policies for input packages in 9.1 --- internal/testrunner/runners/policy/policy.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/internal/testrunner/runners/policy/policy.go b/internal/testrunner/runners/policy/policy.go index e57ab4ec88..39ac7d60e0 100644 --- a/internal/testrunner/runners/policy/policy.go +++ b/internal/testrunner/runners/policy/policy.go @@ -154,6 +154,16 @@ var policyEntryFilters = []policyEntryFilter{ // Namespaces may not be present in older versions of the stack. {name: "namespaces", onlyIfEmpty: true, ignoreValues: []any{"default"}}, + + // Values set by Fleet in input packages starting on 9.1.0. + {name: "inputs", elementsEntries: []policyEntryFilter{ + {name: "streams", elementsEntries: []policyEntryFilter{ + {name: "data_stream.type"}, + {name: "data_stream.elasticsearch.dynamic_dataset"}, + {name: "data_stream.elasticsearch.dynamic_namespace"}, + {name: "data_stream.elasticsearch", onlyIfEmpty: true}, + }}, + }}, } // cleanPolicy prepares a policy YAML as returned by the download API to be compared with other @@ -239,6 +249,8 @@ func isEmpty(v any, ignoreValues []any) bool { return len(filterIgnored(v, ignoreValues)) == 0 case map[string]any: return len(v) == 0 + case common.MapStr: + return len(v) == 0 } return false