From 10c15d7a67933939ec1396f019e1d0b95dcea499 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Tue, 7 Mar 2023 13:29:48 +0100 Subject: [PATCH] test/integration/logs: replace assert.Contains For long strings the output of assert.Contains is not very readable. --- test/integration/logs/benchmark/load_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/integration/logs/benchmark/load_test.go b/test/integration/logs/benchmark/load_test.go index bc95b5e8eb0..36a05987caa 100644 --- a/test/integration/logs/benchmark/load_test.go +++ b/test/integration/logs/benchmark/load_test.go @@ -19,6 +19,7 @@ package benchmark import ( "bytes" "errors" + "strings" "testing" "github.com/stretchr/testify/assert" @@ -235,7 +236,10 @@ while true; do sleep 1; done print(format) klog.Flush() - assert.Equal(t, expected, buffer.String()) + + if !strings.Contains(buffer.String(), expected) { + t.Errorf("Expected log output to contain:\n%s\nActual log output:\n%s\n", expected, buffer.String()) + } } t.Run("printf", func(t *testing.T) {