MCPcopy
hub / github.com/istio/istio / Equal

Function Equal

pkg/test/util/assert/assert.go:84–93  ·  view source on GitHub ↗

Equal compares two objects and fails if they are not the same.

(t test.Failer, a, b T, context ...string)

Source from the content-addressed store, hash-verified

82
83// Equal compares two objects and fails if they are not the same.
84func Equal[T any](t test.Failer, a, b T, context ...string) {
85 t.Helper()
86 if !cmp.Equal(a, b, opts(a)...) {
87 cs := ""
88 if len(context) > 0 {
89 cs = " " + strings.Join(context, ", ") + ":"
90 }
91 t.Fatalf("found diff:%s %v\nLeft: %v\nRight: %v", cs, cmp.Diff(a, b, opts(a)...), a, b)
92 }
93}
94
95// EventuallyEqual compares repeatedly calls the fetch function until the result matches the expectation.
96func EventuallyEqual[T any](t test.Failer, fetch func() T, expected T, retryOpts ...retry.Option) {

Calls 5

optsFunction · 0.85
HelperMethod · 0.65
EqualMethod · 0.65
FatalfMethod · 0.65
DiffMethod · 0.45

Used in the wild real call sites across dependent graphs

searching dependent graphs…