test/integration/logs: replace assert.Contains

For long strings the output of assert.Contains is not very readable.
This commit is contained in:
Patrick Ohly 2023-03-07 13:29:48 +01:00
parent a862a269b0
commit 10c15d7a67

View File

@ -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) {