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

"Unexpected end event" running provider tests in gradle #1310

Open
PhilHardwick opened this issue Feb 18, 2021 · 2 comments
Open

"Unexpected end event" running provider tests in gradle #1310

PhilHardwick opened this issue Feb 18, 2021 · 2 comments
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@PhilHardwick
Copy link
Contributor

PhilHardwick commented Feb 18, 2021

I'm getting this error ("Unexpected end event") with pending pacts on pact-jvm version 4.1.17. #1221 mentioned the same thing but these pacts are for a service in production, so I don't think we had put things in a bad state - although I won't rule out the possibility. But I wanted to check if the following is correct:

From what I'm seeing, Gradle has a cache of tests it's executing as you said (in the other issue). It puts the current test in the cache when the Junit notifier calls the test started method. Pact does this manually here:

As you can see this doesn't happen if it's a pending pact. However further down the InteractionRunner calls the fireTestFinished method for pending pacts:

(the if statement for pending pacts happens a few lines later) - this causes the issue of "Unexpected end event". Should the call to fireTestFinished be wrapped in an if (!pending)?

What I'm not sure about is why this is happening for just this test - and not in any of the other services that run pact tests. I'll try debug through the same points and see what happens in other services tomorrow.

@uglyog
Copy link
Member

uglyog commented Feb 20, 2021

For pending pacts, it should fire TestIgnored not TestStarted and then not fire TestFinished. It might be because the pending test is actually passing, so it is then firing the TestFinished event. I think it does need the if guard.

@uglyog uglyog added the bug Indicates an unexpected problem or unintended behavior label Feb 20, 2021
@uglyog
Copy link
Member

uglyog commented Mar 13, 2021

4.1.18 released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants