diff --git a/tests/e2e/e2ematcher/matcher.go b/tests/e2e/e2ematcher/matcher.go index 7faf15f5..fd410408 100644 --- a/tests/e2e/e2ematcher/matcher.go +++ b/tests/e2e/e2ematcher/matcher.go @@ -1,6 +1,8 @@ package e2ematcher import ( + "fmt" + "github.com/hashicorp/go-multierror" ) @@ -42,3 +44,11 @@ func Any(ms ...Matcher) Matcher { return retErr }) } + +func MapContainsMatchers[K comparable, V any](m map[K]V) map[string]any { + matchers := make(map[string]any, len(m)) + for k, v := range m { + matchers[fmt.Sprint(k)] = ValidatorEq(v) + } + return matchers +} diff --git a/tests/e2e/envfuncsext/nebulacluster-ready-func.go b/tests/e2e/envfuncsext/nebulacluster-ready-func.go index af873d6d..755d5aed 100644 --- a/tests/e2e/envfuncsext/nebulacluster-ready-func.go +++ b/tests/e2e/envfuncsext/nebulacluster-ready-func.go @@ -330,12 +330,7 @@ func isComponentConfigMapExpected(ctx context.Context, cfg *envconf.Config, comp return false } - matchers := make(map[string]any, len(componentConfigExpected)) - for k, v := range componentConfigExpected { - matchers[k] = e2ematcher.ValidatorEq(v) - } - - if err := e2ematcher.Struct(componentConfig, matchers); err != nil { + if err := e2ematcher.Struct(componentConfig, e2ematcher.MapContainsMatchers(componentConfigExpected)); err != nil { klog.ErrorS(err, "Waiting for NebulaCluster to be ready but ConfigMap not expected", "namespace", cm.Namespace, "name", cm.Name,