mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
test/integration/logs: replace assert.Contains
For long strings the output of assert.Contains is not very readable.
This commit is contained in:
parent
a862a269b0
commit
10c15d7a67
@ -19,6 +19,7 @@ package benchmark
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
@ -235,7 +236,10 @@ while true; do sleep 1; done
|
|||||||
|
|
||||||
print(format)
|
print(format)
|
||||||
klog.Flush()
|
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) {
|
t.Run("printf", func(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user