CmpOpts overrides should be passed through (#2621)

This commit is contained in:
Dave Protasowski 2022-11-01 10:38:11 -04:00 committed by GitHub
parent 64fc3e502d
commit 8fa1a3f55b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -387,10 +387,13 @@ func (tt TableTest) Test(t *testing.T, factory Factory) {
t.Run(test.Name, func(t *testing.T) {
t.Helper()
test.Test(t, factory)
opts := make([]cmp.Option, 0, len(defaultCmpOpts)+len(test.CmpOpts))
opts = append(opts, defaultCmpOpts...)
opts = append(opts, test.CmpOpts...)
// Validate cached objects do not get soiled after controller loops.
if !cmp.Equal(originObjects, test.Objects, defaultCmpOpts...) {
if !cmp.Equal(originObjects, test.Objects, opts...) {
t.Errorf("Unexpected objects (-want, +got):\n%s",
cmp.Diff(originObjects, test.Objects, defaultCmpOpts...))
cmp.Diff(originObjects, test.Objects, opts...))
}
})
}