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

Diff only after checking repeatability #1694

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rokatyy
Copy link

@rokatyy rokatyy commented Jan 7, 2025

Summary

Optimisation of findExpectedCall

Motivation

That's quite a long story about how I got here. We are migrating Nuclio from Go version 1.21 to 1.23, and apparently, something has changed there in between. This test stopped working, failing on a mock call. So, I decided to dig into how testify works and noticed that if you have more than one call of the same function in ExpectedCalls, the Diff function will still run against it, even if the function has already been called once and its Repeatability is -1. And it would be fine if only we didn't have suite.Require().Equal as part of mock.MatchedBy function, which failed on the 1st iteration here without even reaching the required iteration in ExpectedCalls.

UPD:I noticed that the tests fail in cases where this function returns a call without considering Repeatability. While this behavior is tied to the implementation details, it can take quite a bit of time to figure out the root cause of these failures, which isn't ideal from a UX perspective. This PR is more of a suggestion rather than a change request, so feel free to close it if you believe it’s unnecessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant