From b3f4cd66cd84e72bc4fd6884018c1ae43cb037dc Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Mon, 24 Oct 2022 16:08:02 +0200 Subject: [PATCH] e2e framework: add -gomega-max-length parameter When gomega.format exceeds the default size of 4000, it truncates and prints: Gomega truncated this representation as it exceeds 'format.MaxLength'. Consider having the object provide a custom 'GomegaStringer' representation or adjust the parameters in Gomega's 'format' package. Learn more here: https://onsi.github.io/gomega/#adjusting-output These instructions don't help the user of the e2e.test binary unless we provide a command line flag. --- test/e2e/framework/test_context.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/e2e/framework/test_context.go b/test/e2e/framework/test_context.go index afb7654ec2b..400a043077a 100644 --- a/test/e2e/framework/test_context.go +++ b/test/e2e/framework/test_context.go @@ -32,6 +32,7 @@ import ( "github.com/onsi/ginkgo/v2" "github.com/onsi/ginkgo/v2/reporters" "github.com/onsi/ginkgo/v2/types" + gomegaformat "github.com/onsi/gomega/format" restclient "k8s.io/client-go/rest" "k8s.io/client-go/tools/clientcmd" @@ -307,6 +308,9 @@ func (tc TestContextType) ClusterIsIPv6() bool { // options themselves, copy flags from test/e2e/framework/config // as shown in HandleFlags. func RegisterCommonFlags(flags *flag.FlagSet) { + // The default is too low for objects like pods, even when using YAML. We double the default. + flags.IntVar(&gomegaformat.MaxLength, "gomega-max-length", 8000, "Sets the maximum size for the gomega formatter (= gomega.MaxLength). Use 0 to disable truncation.") + flags.StringVar(&TestContext.GatherKubeSystemResourceUsageData, "gather-resource-usage", "false", "If set to 'true' or 'all' framework will be monitoring resource usage of system all add-ons in (some) e2e tests, if set to 'master' framework will be monitoring master node only, if set to 'none' of 'false' monitoring will be turned off.") flags.BoolVar(&TestContext.GatherLogsSizes, "gather-logs-sizes", false, "If set to true framework will be monitoring logs sizes on all machines running e2e tests.") flags.IntVar(&TestContext.MaxNodesToGather, "max-nodes-to-gather-from", 20, "The maximum number of nodes to gather extended info from on test failure.")