GitHub user aledsage opened a pull request:
https://github.com/apache/brooklyn-server/pull/165
Fix StopAfterDurationPolicyTest
Previously test failed in jenkins when asserting state was RUNNING,
then STOPPED. Unclear if this re-write will fix that (!), but at least
weâll get more info about what states it was in.
There was another race, which this fixes: the policy might shutdown the
entity before we manage to assert it is RUNNING (if we were extremely unlucky
with the main thread context switching!).
The failure was in
https://builds.apache.org/job/brooklyn-server-pull-requests/org.apache.brooklyn$brooklyn-policy/460/testReport/junit/org.apache.brooklyn.policy.action/StopAfterDurationPolicyTest/testAppStoppedWhenDurationExpires/:
```
2016-05-27 20:39:41,707 INFO TESTNG INVOKING CONFIGURATION: "Surefire
test" - @BeforeMethod
org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport.setUp()
2016-05-27 20:39:41,734 INFO TESTNG PASSED CONFIGURATION: "Surefire test"
- @BeforeMethod
org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport.setUp() finished in 28
ms
2016-05-27 20:39:41,734 INFO TESTNG INVOKING: "Surefire test" -
org.apache.brooklyn.policy.action.StopAfterDurationPolicyTest.testAppStoppedWhenDurationExpires()
2016-05-27 20:39:41,754 INFO No Camp-YAML parser registered for parsing
catalog item DSL; skipping DSL-parsing
2016-05-27 20:40:11,771 INFO succeedsEventually exceeded max attempts or
timeout - 69 attempts lasting 30001 ms, for
RunnableAdapter(org.apache.brooklyn.core.entity.EntityAsserts$1@6879b52d)
2016-05-27 20:40:11,772 INFO failed succeeds-eventually, 69 attempts,
30002ms elapsed (rethrowing): java.lang.AssertionError:
entity=Application[REyzoEtY]; attribute=Sensor: service.state
(org.apache.brooklyn.core.entity.lifecycle.Lifecycle) expected [stopped] but
found [stopping]
2016-05-27 20:40:11,775 INFO TESTNG FAILED: "Surefire test" -
org.apache.brooklyn.policy.action.StopAfterDurationPolicyTest.testAppStoppedWhenDurationExpires()
finished in 30039 ms
org.apache.brooklyn.util.exceptions.PropagatedRuntimeException: failed
succeeds-eventually, 69 attempts, 30002ms elapsed: AssertionError:
entity=Application[REyzoEtY]; attribute=Sensor: service.state
(org.apache.brooklyn.core.entity.lifecycle.Lifecycle) expected [stopped] but
found [stopping]
at
org.apache.brooklyn.util.exceptions.Exceptions.propagate(Exceptions.java:164)
at
org.apache.brooklyn.util.exceptions.Exceptions.propagateAnnotated(Exceptions.java:144)
at org.apache.brooklyn.test.Asserts.succeedsEventually(Asserts.java:963)
at org.apache.brooklyn.test.Asserts.succeedsEventually(Asserts.java:854)
at
org.apache.brooklyn.core.entity.EntityAsserts.assertAttributeEqualsEventually(EntityAsserts.java:67)
at
org.apache.brooklyn.core.entity.EntityAsserts.assertAttributeEqualsEventually(EntityAsserts.java:62)
at
org.apache.brooklyn.policy.action.StopAfterDurationPolicyTest.testAppStoppedWhenDurationExpires(StopAfterDurationPolicyTest.java:43)
Caused by: java.lang.AssertionError: entity=Application[REyzoEtY];
attribute=Sensor: service.state
(org.apache.brooklyn.core.entity.lifecycle.Lifecycle) expected [stopped] but
found [stopping]
at org.apache.brooklyn.test.Asserts.fail(Asserts.java:721)
at org.apache.brooklyn.test.Asserts.failNotEquals(Asserts.java:114)
at org.apache.brooklyn.test.Asserts.assertEquals(Asserts.java:436)
at
org.apache.brooklyn.core.entity.EntityAsserts.assertAttributeEquals(EntityAsserts.java:54)
at
org.apache.brooklyn.core.entity.EntityAsserts$1.run(EntityAsserts.java:70)
at
org.apache.brooklyn.test.Asserts$RunnableAdapter.call(Asserts.java:1277)
at org.apache.brooklyn.test.Asserts.succeedsEventually(Asserts.java:930)
... 32 more
```
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/aledsage/brooklyn-server
fix/StopAfterDurationPolicyTest
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/brooklyn-server/pull/165.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 #165
----
commit 8e9a79858e758d21c7e73c5de1a32d44a951fa99
Author: Aled Sage <[email protected]>
Date: 2016-05-28T13:14:30Z
Fix StopAfterDurationPolicyTest
Previously test failed in jenkins when asserting state was RUNNING,
then STOPPED. Unclear if this re-write will fix that (!), but at least
weâll get more info about what states it was in.
----
---
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.
---