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

Document (or remove?) requirement to run tests in own VM if multiple test classes using LightblueExternalResource #240

Open
alechenninger opened this issue Jan 12, 2016 · 5 comments

Comments

@alechenninger
Copy link
Contributor

Taken from discussion in #231

You have to tell surefire to run the tests in a fork for this to work:

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.19</version>
    <configuration>
        <!-- forkCount is 1 by default. -->
        <!-- <forkCount>1</forkCount> -->
        <reuseForks>false</reuseForks>
    </configuration>
  </plugin>

This should probably be documented somewhere. Another solution would be to find a way to remove this requirement.

Thanks!

@dcrissman
Copy link
Member

There are multiple examples of tests running sequentially. Are you running tests simultaneously? Could you provide an example?

@alechenninger
Copy link
Contributor Author

multiple test classes

@alechenninger
Copy link
Contributor Author

Sorry, the example is described in #231. If you have multiple test classes using the resource, the second test class to run using the resource will have problems if the tests are not run in a fork.

@alechenninger
Copy link
Contributor Author

I understand this a little better now. The forkCount is 1 by default. It's the reuseForks bit that is actually important. It makes each test class run in a new VM, which means each test class individually triggers VM shutdown hooks, which causes the appropriate shutdown steps to happen before a new mongo/lightblue-rest can be stood up.

A fix would be to make those not VM shutdown hooks and just call them at the end of the rule like normal rules.

@alechenninger
Copy link
Contributor Author

Another fix would be for the rule to detect instances of mongo and/or lightblue-rest are already running and reuse them.

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

No branches or pull requests

2 participants