Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testify: assert.Equal fails OoM when comparing protos #138

Open
yuryu opened this issue Dec 11, 2020 · 0 comments
Open

testify: assert.Equal fails OoM when comparing protos #138

yuryu opened this issue Dec 11, 2020 · 0 comments
Labels
documentation Improvements or additions to documentation

Comments

@yuryu
Copy link
Member

yuryu commented Dec 11, 2020

What happened:
This is not yet merged, but I'm leaving it as a caution to future developers.

When comparing two values containing protos, testify goes in an infinite loop and eventually dies oom.
Expressions like

assert.Equal(t, expected.Properties, actual.Properties)

do not work when there are diffs.
See related bugs here:

So... until there is a fix, we need to have a workaround.

What you expected to happen:
assert.Equal compares two values, outputs diffs if there is any, and returns.

How to reproduce it (as minimally and precisely as possible):
If I change assertEqualRecord as follows in open-saves_test.go, it fails.

func assertEqualRecord(t *testing.T, expected, actual *pb.Record) {
	t.Helper()
	if expected == nil {
		assert.Nil(t, actual)
		return
	}
	if assert.NotNil(t, actual) {
		assert.Equal(t, expected.Key, actual.Key)
		assert.Equal(t, expected.Blob, actual.Blob)
		assert.Equal(t, expected.BlobSize, actual.BlobSize)
		assert.ElementsMatch(t, expected.Tags, actual.Tags)
		assert.Equal(t, expected.OwnerId, actual.OwnerId)
		assert.Equal(t, expected.Properties, actual.Properties)
		assertTimestampsWithinDelta(t, expected.GetCreatedAt(), actual.GetCreatedAt())
		assertTimestampsWithinDelta(t, expected.GetUpdatedAt(), actual.GetUpdatedAt())
	}
}

Anything else we need to know?:

Environment:

  • Open Saves version:
  • Kubernetes version (use kubectl version):
  • Cloud provider or hardware configuration:
  • Install method (yaml/helm):
  • Troubleshooting guide log(s):
  • Others:
@yuryu yuryu added the documentation Improvements or additions to documentation label Dec 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant