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

fix atMost + timeout verify #1185

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ class TimeoutVerifier(
val stubs = verificationSequence.allStubs(stubRepo)

val session = stubRepo.openRecordCallAwaitSession(stubs, params.timeout)
val startTime = System.currentTimeMillis()
try {
while (true) {
val result = verifierChain.verify(verificationSequence, params)
if (params.inverse != result.matches) {
// With atMost set the reaching expected result does not mean test passed
// - it can fail till the end of the timeout
if (params.inverse != result.matches &&
(params.max != Int.MAX_VALUE && (System.currentTimeMillis() - startTime < params.timeout))) {
return result // passed
}
if (!session.wait()) {
Expand Down