GitHub user aledsage opened a pull request:
https://github.com/apache/brooklyn-server/pull/357
Fix LocalhostMachineProvisioningLocationTest
Use @BeforeMethod rather than @BeforeClass for test setup/teardown
The PR build for https://github.com/apache/brooklyn-server/pull/355 (see
https://builds.apache.org/job/brooklyn-server-pull-requests/org.apache.brooklyn$brooklyn-core/1138/consoleFull)
shows all but the first test in `LocalhostMachineProvisioningLocationTest`
failing with the exception:
```
2016-09-27 21:49:31,219 INFO TESTNG FAILED: "Surefire test" -
org.apache.brooklyn.location.localhost.LocalhostMachineProvisioningLocationTest.obtainLowNumberedPortsAutomatically()
finished in 0 ms
java.lang.IllegalStateException: Management context no longer running
at
org.apache.brooklyn.core.mgmt.internal.LocalManagementContext.getLocationManager(LocalManagementContext.java:270)
at
org.apache.brooklyn.location.localhost.LocalhostMachineProvisioningLocationTest.newLocalhostProvisioner(LocalhostMachineProvisioningLocationTest.java:71)
at
org.apache.brooklyn.location.localhost.LocalhostMachineProvisioningLocationTest.obtainLowNumberedPortsAutomatically(LocalhostMachineProvisioningLocationTest.java:161)
```
Looking at the console output, there are tests from other classes run
between the first and subsequent tests in
`LocalhostMachineProvisioningLocationTest`. Presumably one of these spotted
that there was a management context left running, and terminated it?!
The fix should be simple: to change the test to use `@BeforeMethod` and
`@AfterMethod` like our other tests do.
Not sure why jenkins/surefire ran the tests in a strange order. Hopefully
it's not running the tests concurrently, but was instead just interleaving
tests from different classes?
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/aledsage/brooklyn-server
fix-LocalhostMachineProvisioningLocationTest
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/brooklyn-server/pull/357.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #357
----
commit 448c15901369e916242a9b8c26359d825137a40f
Author: Aled Sage <[email protected]>
Date: 2016-09-28T11:09:03Z
Fix LocalhostMachineProvisioningLocationTest
Use @BeforeMethod rather than @BeforeClass for test setup/teardown
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---