You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by "Aled Sage (JIRA)" <ji...@apache.org> on 2016/11/02 14:34:58 UTC

[jira] [Commented] (BROOKLYN-377) Test DSL breaks with multiple applications

    [ https://issues.apache.org/jira/browse/BROOKLYN-377?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15629146#comment-15629146 ] 

Aled Sage commented on BROOKLYN-377:
------------------------------------

This is not caused by multiple apps - it is just more likely to happen when there are multiple apps, because each has approx a 50% chance of failing.

The workaround is to specify an explicit timeout config value in the blueprint (or a value for {{timeout.initialStartup}}).

The underlying problem is that the config value for timeout is non-deterministic: sometimes it is null, sometimes it correctly picks up the default of 1 hour. When null, it defaults to 30 seconds so the test fails.

Debugging this, it is related to what Svet is fixing in https://github.com/apache/brooklyn-server/pull/385. I believe that this PR fixes the problem.

Below is a simplified test case that shows the non-deterministic failure (which I'll add to {{ConfigInheritanceYamlTest}}):

{noformat}
    @Test(invocationCount=100)
    public void testDefaultOnBrooklynParams() throws Exception {
        addCatalogItems(
                "brooklyn.catalog:",
                "  version: 1.0.0",
                "  itemType: entity",
                "  items:",
                "  - id: test-entity",
                "    item:",
                "      type: "+MyTestEntity.class.getName(), 
                "  - id: test-app",
                "    item:",
                "      type: " + BasicApplication.class.getName(),
                "      brooklyn.parameters:",
                "      - name: myParam",
                "        type: String",
                "        default: myVal",
                "      brooklyn.config:",
                "        test.confName: $brooklyn:scopeRoot().config(\"myParam\")",
                "      brooklyn.children:",
                "      - type: test-entity"
                );

        Entity app = createStartWaitAndLogApplication(Joiner.on("\n").join(
                "services:",
                "- type: "+BasicApplication.class.getName(),
                "  brooklyn.children:",
                "  - type: test-app"));
        
        MyTestEntity testEntity = (MyTestEntity) Iterables.find(Entities.descendantsAndSelf(app), Predicates.instanceOf(MyTestEntity.class));
        assertEquals(testEntity.config().get(MyTestEntity.CONF_NAME), "myVal");
        assertEquals(testEntity.sensors().get(MyTestEntity.MY_SENSOR), "myVal");
    }

    @ImplementedBy(MyTestEntityImpl.class)
    public static interface MyTestEntity extends TestEntity {
        public static final AttributeSensor<String> MY_SENSOR = Sensors.newStringSensor("myTestEntity.sensor");
    }

    public static class MyTestEntityImpl extends TestEntityImpl implements MyTestEntity {
        @Override
        public void start(Collection<? extends Location> locs) {
            String val = getConfig(CONF_NAME);
            sensors().set(MY_SENSOR, val);
            super.start(locs);
            
        }
    }
{noformat}

> Test DSL breaks with multiple applications
> ------------------------------------------
>
>                 Key: BROOKLYN-377
>                 URL: https://issues.apache.org/jira/browse/BROOKLYN-377
>             Project: Brooklyn
>          Issue Type: Bug
>            Reporter: Duncan Godwin
>
> When multiple different test applications are started, these appear to interact causing one to fail with the error
> {code}AssertionError: service.isUp expected equals true but found false{code}
> An example blueprint:
> {code}
> brooklyn.catalog:
>   version: "4.1.0-SNAPSHOT" # AMP_VERSION
>   items:
>   - "https://raw.githubusercontent.com/brooklyncentral/common-catalog-utils/master/common-tests/src/main/resources/commontests/common.tests.bom"
>   - "https://raw.githubusercontent.com/brooklyncentral/brooklyn-tomcat-7-server/master/catalog.bom"
>   - "https://raw.githubusercontent.com/brooklyncentral/brooklyn-jboss-application-server-6/master/catalog.bom"
>   - id: TomcatTest
>     itemType: template
>     name: Tomcat Test
>     item:
>       services:
>       - type: brooklyn-tomcat-7-server
>         id: target-app1
>       - type: test-case
>         brooklyn.config:
>           targetId: target-app1
>         brooklyn.children:
>           - type: assert-up-and-running-initial
>             name: "1. Target app up and running"
>   - id: Jboss6ASTest
>     itemType: template
>     name: JBoss 6 AS Test
>     item:
>       services:
>       - type: brooklyn-jboss-application-server-6
>         id: target-app2
>       - type: test-case
>         brooklyn.config:
>           targetId: target-app2
>         brooklyn.children:
>           - type: assert-up-and-running-initial
>             name: "1. Target app up and running"
> {code}
> Then start both {{TomcatTest}} and {{Jboss6ASTest}} at the same time. The log contains:
> {code}
> 2016-11-01 17:37:11,140 DEBUG 115 o.a.b.c.b.s.d.BrooklynDslDeferredSupplier [ager-gr9jaMDG-15] Queuing task to resolve $brooklyn:scopeRoot().config("timeout.initialStartup"), called by Task[retrieving config for timeout.initialStartup]@fRU8hX4P
> 2016-11-01 17:37:11,141 DEBUG 115 o.a.b.c.b.s.d.BrooklynDslDeferredSupplier [ager-gr9jaMDG-15] Resolved TestSensorImpl{id=tyw62yh1qe} from $brooklyn:scopeRoot().config("timeout.initialStartup")
> 2016-11-01 17:37:11,142 DEBUG 115 o.a.b.c.b.s.d.BrooklynDslDeferredSupplier [ager-gr9jaMDG-16] Resolved null from $brooklyn:scopeRoot().config("timeout.initialStartup")
> 2016-11-01 17:37:11,150 DEBUG 140 o.a.b.u.r.Repeater [nager-gr9jaMDG-0] Repeater
> java.lang.AssertionError: service.isUp expected equals true but found false
>         at org.apache.brooklyn.test.framework.TestFrameworkAssertions.failAssertion(TestFrameworkAssertions.java:423)
>         at org.apache.brooklyn.test.framework.TestFrameworkAssertions.checkActualAgainstAssertions(TestFrameworkAssertions.java:296)
>         at org.apache.brooklyn.test.framework.TestFrameworkAssertions$3.call(TestFrameworkAssertions.java:253)
>         at org.apache.brooklyn.test.framework.TestFrameworkAssertions$3.call(TestFrameworkAssertions.java:244)
>         at org.apache.brooklyn.util.repeat.Repeater.runKeepingError(Repeater.java:336)
>         at org.apache.brooklyn.util.repeat.Repeater.runRequiringTrue(Repeater.java:307)
>         at org.apache.brooklyn.test.framework.TestFrameworkAssertions.checkAssertionsEventually(TestFrameworkAssertions.java:243)
>         at org.apache.brooklyn.test.framework.TestFrameworkAssertions.checkAssertionsEventually(TestFrameworkAssertions.java:212)
>         at org.apache.brooklyn.test.framework.TestSensorImpl.start(TestSensorImpl.java:77)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.7.0_80]
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_80]
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_80]
>         at java.lang.reflect.Method.invoke(Method.java:606)[:1.7.0_80]
>         at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)[85:groovy-all:2.3.7]
>         at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)[85:groovy-all:2.3.7]
>         at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1207)[85:groovy-all:2.3.7]
>         at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)[85:groovy-all:2.3.7]
>         at groovy.lang.DelegatingMetaClass.invokeMethod(DelegatingMetaClass.java:149)[85:groovy-all:2.3.7]
>         at groovy.lang.MetaObjectProtocol$invokeMethod.call(Unknown Source)[jar:bundle://85.0:0/!/:2.3.7]
>         at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)[85:groovy-all:2.3.7]
>         at groovy.lang.MetaObjectProtocol$invokeMethod.call(Unknown Source)[jar:bundle://85.0:0/!/:2.3.7]
>         at org.apache.brooklyn.util.groovy.GroovyJavaMethods.invokeMethodOnMetaClass(GroovyJavaMethods.java:191)[141:org.apache.brooklyn.utils-groovy:0.10.0.20161013_2025]
>         at org.apache.brooklyn.core.mgmt.internal.AbstractManagementContext.invokeEffectorMethodLocal(AbstractManagementContext.java:315)[117:org.apache.brooklyn.core:0.10.0.20161013_2025]
>         at org.apache.brooklyn.core.mgmt.internal.AbstractManagementContext.invokeEffectorMethodSync(AbstractManagementContext.java:339)[117:org.apache.brooklyn.core:0.10.0.20161013_2025]
>         at org.apache.brooklyn.core.mgmt.internal.EffectorUtils.invokeMethodEffector(EffectorUtils.java:276)[117:org.apache.brooklyn.core:0.10.0.20161013_2025]
>         at org.apache.brooklyn.core.effector.MethodEffector.call(MethodEffector.java:148)[117:org.apache.brooklyn.core:0.10.0.20161013_2025]
>         at org.apache.brooklyn.core.entity.trait.Startable$StartEffectorBody.call(Startable.java:56)[117:org.apache.brooklyn.core:0.10.0.20161013_2025]
>         at org.apache.brooklyn.core.entity.trait.Startable$StartEffectorBody.call(Startable.java:50)[117:org.apache.brooklyn.core:0.10.0.20161013_2025]
>         at org.apache.brooklyn.core.effector.EffectorTasks$EffectorBodyTaskFactory$1.call(EffectorTasks.java:82)[117:org.apache.brooklyn.core:0.10.0.20161013_2025]
>         at org.apache.brooklyn.util.core.task.DynamicSequentialTask$DstJob.call(DynamicSequentialTask.java:359)[117:org.apache.brooklyn.core:0.10.0.20161013_2025]
>         at org.apache.brooklyn.util.core.task.BasicExecutionManager$SubmissionCallable.call(BasicExecutionManager.java:522)[117:org.apache.brooklyn.core:0.10.0.20161013_2025]
>         at java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_80]
>         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_80]
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_80]
>         at java.lang.Thread.run(Thread.java:745)[:1.7.0_80]
> 2016-11-01 17:37:11,152 DEBUG 140 o.a.b.u.r.Repeater [nager-gr9jaMDG-0] Repeater: unsatisfied during iteration 1 (max 2147483647 attempts)(30.0s remaining)
> 2016-11-01 17:37:11,154 DEBUG 140 o.a.b.u.r.Repeater [nager-gr9jaMDG-0] Repeater
> java.lang.AssertionError: service.isUp expected equals true but found false
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)