You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by aledsage <gi...@git.apache.org> on 2014/11/19 01:38:31 UTC

[GitHub] incubator-brooklyn pull request: Fix MongoDB sharded

GitHub user aledsage opened a pull request:

    https://github.com/apache/incubator-brooklyn/pull/345

    Fix MongoDB sharded

    @Nakomis can you please review.
    
    I couldn't reproduce the other error you were seeing yet. Let's discuss again tomorrow, hopefully with these fixes in place.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/aledsage/incubator-brooklyn fix/various-20141118-mongo

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-brooklyn/pull/345.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 #345
    
----
commit ac6fea14dc7aae2ddcefee2482dba4601633f369
Author: Aled Sage <al...@gmail.com>
Date:   2014-11-18T21:57:05Z

    Adds tests for MongoDB yaml blueprints

commit 777fde2893be09cf5e54375e9151b6c85341eb64
Author: Aled Sage <al...@gmail.com>
Date:   2014-11-18T22:05:26Z

    Fix sharded-mongodb, with CoLocatedMongoDbRouter
    
    - was getting NPE in CoLocatedMongoDbRouter.init, while trying to
      resolve config set in yam that pointed at another entity.

commit 0ac1d475772d7c6b4d9431e949c65b94a0baec9e
Author: Aled Sage <al...@gmail.com>
Date:   2014-11-18T22:05:49Z

    EntityTestUtils: improve error messages

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Fix MongoDB sharded

Posted by nakomis <gi...@git.apache.org>.
Github user nakomis commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/345#discussion_r20564697
  
    --- Diff: usage/launcher/src/test/java/brooklyn/launcher/blueprints/MongoDbBlueprintTest.java ---
    @@ -0,0 +1,98 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +package brooklyn.launcher.blueprints;
    +
    +import static org.testng.Assert.assertNotEquals;
    +
    +import org.testng.annotations.AfterMethod;
    +import org.testng.annotations.BeforeMethod;
    +import org.testng.annotations.Test;
    +
    +import brooklyn.entity.Application;
    +import brooklyn.entity.Entity;
    +import brooklyn.entity.basic.Attributes;
    +import brooklyn.entity.basic.Entities;
    +import brooklyn.entity.basic.Lifecycle;
    +import brooklyn.launcher.BrooklynLauncher;
    +import brooklyn.launcher.SimpleYamlLauncherForTests;
    +import brooklyn.test.Asserts;
    +import brooklyn.test.EntityTestUtils;
    +
    +public class MongoDbBlueprintTest {
    +
    +    // TODO Some tests are failing! Needs investigated.
    +    
    +    private SimpleYamlLauncherForTests launcher;
    +    
    +    // The "viewer" is just for having a Brooklyn web-console available for visual inspection;
    +    // could be removed without affecting behaviour
    +    private BrooklynLauncher viewer;
    +    
    +    @BeforeMethod(alwaysRun=true)
    +    public void setUp() throws Exception {
    +        launcher = new SimpleYamlLauncherForTests();
    +        viewer = BrooklynLauncher.newInstance().managementContext(launcher.getManagementContext()).start();
    +    }
    +    
    +    @AfterMethod(alwaysRun=true)
    +    public void tearDown() throws Exception {
    +        if (launcher != null) launcher.destroyAll();
    +        if (viewer != null) viewer.terminate();
    +    }
    +    
    +    @Test(groups="Integration")
    +    public void testMongoSharded() {
    +        runAppAndAssertNoFires("mongo-sharded.yaml");
    +    }
    +
    +    @Test(groups="Integration")
    +    public void testMongoReplicaSet() {
    +        runAppAndAssertNoFires("mongo-blueprint.yaml");
    +    }
    +
    +    @Test(groups="Integration")
    +    public void testMongoClientAndSingleServer() {
    +        runAppAndAssertNoFires("mongo-client-single-server.yaml");
    +    }
    +
    +    @Test(groups="Integration")
    +    public void testMongoScripts() {
    +        runAppAndAssertNoFires("mongo-scripts.yaml");
    +    }
    +
    +    @Test(groups="Integration")
    +    public void testMongoSingleServer() {
    +        runAppAndAssertNoFires("mongo-single-server-blueprint.yaml");
    +    }
    +
    +    protected void runAppAndAssertNoFires(String yamlFile) {
    +        final Application app = launcher.launchAppYaml(yamlFile);
    +
    +        EntityTestUtils.assertAttributeEqualsEventually(app, Attributes.SERVICE_UP, true);
    +        EntityTestUtils.assertAttributeEqualsEventually(app, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.RUNNING);
    +        
    +        Asserts.succeedsEventually(new Runnable() {
    +            public void run() {
    +                for (Entity entity : Entities.descendants(app)) {
    +                    assertNotEquals(entity.getAttribute(Attributes.SERVICE_STATE_ACTUAL), Lifecycle.ON_FIRE);
    +                    assertNotEquals(entity.getAttribute(Attributes.SERVICE_UP), false);
    --- End diff --
    
    Would this succeed if SERVICE_UP is null? May be clear to use assertEquals


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Fix MongoDB sharded

Posted by aledsage <gi...@git.apache.org>.
Github user aledsage commented on the pull request:

    https://github.com/apache/incubator-brooklyn/pull/345#issuecomment-67470898
  
    @sjcorbett I've marked the `MongoDbBlueprintTest` as `WIP`.
    
    I've also extracted `AbstractBlueprintTest`, and included in that a rebind call. That duplicates a bit of code from `brooklyn.entity.rebind.RebindTestFixture`, which I'm not particularly happy about. But didn't want to get into refactoring that just now.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Fix MongoDB sharded

Posted by sjcorbett <gi...@git.apache.org>.
Github user sjcorbett commented on the pull request:

    https://github.com/apache/incubator-brooklyn/pull/345#issuecomment-67629519
  
    Looks good. Merging.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Fix MongoDB sharded

Posted by sjcorbett <gi...@git.apache.org>.
Github user sjcorbett commented on the pull request:

    https://github.com/apache/incubator-brooklyn/pull/345#issuecomment-66264714
  
    @aledsage Is it worth marking the failing tests `WIP` and moving this pull request on?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Fix MongoDB sharded

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-brooklyn/pull/345


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: Fix MongoDB sharded

Posted by nakomis <gi...@git.apache.org>.
Github user nakomis commented on the pull request:

    https://github.com/apache/incubator-brooklyn/pull/345#issuecomment-63614487
  
    Looked into why the tests are failing:
    testMongoReplicaSet fails as the YAML does not contain a location. Adding `location: localhost` fixes it
    testMongoSharded fails as the war "brooklyn-example-hello-world-sql-webapp.war" is not on the classpath. The Riak YAML files use ""https://s3-eu-west-1.amazonaws.com/brooklyn-clocker/brooklyn-example-hello-world-sql-webapp.war" as the wars.root, but I'm not sure this is the best location for it
    testMongoClientAndSingleServer, testMongoScripts, and testMongoSingleServer all pass


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---