brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [06/17] git commit: Fixed CouchbaseSyncGateway live tests
Date Mon, 01 Sep 2014 16:14:44 GMT
Fixed CouchbaseSyncGateway live tests


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/48c22178
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/48c22178
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/48c22178

Branch: refs/heads/master
Commit: 48c22178417698c7891a4cd29ebc78d5d1db2ec9
Parents: 7d0467d
Author: Martin Harris <github@nakomis.com>
Authored: Tue Jul 1 10:43:16 2014 +0100
Committer: Martin Harris <github@nakomis.com>
Committed: Mon Aug 18 15:45:44 2014 +0100

----------------------------------------------------------------------
 .../nosql/couchbase/CouchbaseNodeSshDriver.java |  17 ++-
 .../CouchbaseSyncGatewaySshDriver.java          |   9 +-
 .../CouchbaseSyncGatewayEc2LiveTest.java        | 114 +++++++++++++++++++
 3 files changed, 129 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/48c22178/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseNodeSshDriver.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseNodeSshDriver.java
b/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseNodeSshDriver.java
index 6f81b73..8eb95e0 100644
--- a/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseNodeSshDriver.java
+++ b/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseNodeSshDriver.java
@@ -21,6 +21,7 @@ package brooklyn.entity.nosql.couchbase;
 import static brooklyn.util.ssh.BashCommands.INSTALL_CURL;
 import static brooklyn.util.ssh.BashCommands.alternatives;
 import static brooklyn.util.ssh.BashCommands.chainGroup;
+import static brooklyn.util.ssh.BashCommands.ok;
 import static brooklyn.util.ssh.BashCommands.sudo;
 import static java.lang.String.format;
 
@@ -48,7 +49,6 @@ import brooklyn.util.repeat.Repeater;
 import brooklyn.util.ssh.BashCommands;
 import brooklyn.util.task.Tasks;
 import brooklyn.util.time.Duration;
-import brooklyn.util.time.Time;
 
 import com.google.common.base.Function;
 import com.google.common.collect.ImmutableList;
@@ -102,10 +102,13 @@ public class CouchbaseNodeSshDriver extends AbstractSoftwareProcessSshDriver
imp
 
         String yum = chainGroup(
                 "which yum",
-                sudo("yum check-update"),
+                // The following prevents failure on RHEL AWS nodes:
+                // https://forums.aws.amazon.com/thread.jspa?threadID=100509
+                ok(sudo("sed -i.bk s/^enabled=1$/enabled=0/ /etc/yum/pluginconf.d/subscription-manager.conf")),
+                ok(sudo("yum check-update")),
                 sudo("yum install -y pkgconfig"),
                 // RHEL requires openssl version 098
-                sudo("[ -f /etc/redhat-release ] && (grep -i \"red hat\" /etc/redhat-release
&& yum install -y openssl098e) || :"),
+                sudo("[ -f /etc/redhat-release ] && (grep -i \"red hat\" /etc/redhat-release
&& sudo yum install -y openssl098e) || :"),
                 sudo(format("rpm --install %s", saveAs)));
 
         return ImmutableList.<String>builder()
@@ -130,11 +133,15 @@ public class CouchbaseNodeSshDriver extends AbstractSoftwareProcessSshDriver
imp
 
     @Override
     public void launch() {
-        //FIXME needs time for http server to initialize
-        Time.sleep(Duration.TEN_SECONDS);
         newScript(LAUNCHING)
                 .body.append(
                 sudo("/etc/init.d/couchbase-server start"),
+                "for i in {0..120}\n" +
+                "do\n" +
+                "    if [ $i -eq 120 ]; then echo REST API unavailable after 120 seconds,
failing; exit 1; fi;\n" +
+                "    curl -s " + String.format("http://%s:%s", getHostname(), getWebPort())
+ " > /dev/null && echo REST API available after $i seconds && break\n"
+
+                "    sleep 1\n" +
+                "done\n" +
                 couchbaseCli("cluster-init") +
                         getCouchbaseHostnameAndPort() +
                         " --cluster-init-username=" + getUsername() +

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/48c22178/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseSyncGatewaySshDriver.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseSyncGatewaySshDriver.java
b/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseSyncGatewaySshDriver.java
index 7339c40..6d9157c 100644
--- a/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseSyncGatewaySshDriver.java
+++ b/software/nosql/src/main/java/brooklyn/entity/nosql/couchbase/CouchbaseSyncGatewaySshDriver.java
@@ -21,6 +21,7 @@ import brooklyn.location.basic.SshMachineLocation;
 import brooklyn.util.collections.MutableMap;
 import brooklyn.util.ssh.BashCommands;
 import brooklyn.util.time.Duration;
+import brooklyn.util.time.Time;
 
 import com.google.common.base.Optional;
 import com.google.common.base.Predicate;
@@ -66,12 +67,8 @@ public class CouchbaseSyncGatewaySshDriver extends AbstractSoftwareProcessSshDri
         Entity cbNode = entity.getConfig(CouchbaseSyncGateway.COUCHBASE_SERVER);
         Entities.waitForServiceUp(cbNode, Duration.ONE_HOUR);
         DependentConfiguration.waitInTaskForAttributeReady(cbNode, CouchbaseCluster.IS_CLUSTER_INITIALIZED,
Predicates.equalTo(true));
-        try {
-            // Even once the bucket has published its API URL, it can still take a couple
of seconds for it to become available
-            Thread.sleep(10 * 1000);
-        } catch (InterruptedException e) {
-            // no-op
-        }
+        // Even once the bucket has published its API URL, it can still take a couple of
seconds for it to become available
+        Time.sleep(10 * 1000);
         if (cbNode instanceof CouchbaseCluster) {
             Optional<Entity> cbClusterNode = Iterables.tryFind(cbNode.getAttribute(CouchbaseCluster.GROUP_MEMBERS),
new Predicate<Entity>() {
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/48c22178/software/nosql/src/test/java/brooklyn/entity/nosql/couchbase/CouchbaseSyncGatewayEc2LiveTest.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/test/java/brooklyn/entity/nosql/couchbase/CouchbaseSyncGatewayEc2LiveTest.java
b/software/nosql/src/test/java/brooklyn/entity/nosql/couchbase/CouchbaseSyncGatewayEc2LiveTest.java
new file mode 100644
index 0000000..4c659d6
--- /dev/null
+++ b/software/nosql/src/test/java/brooklyn/entity/nosql/couchbase/CouchbaseSyncGatewayEc2LiveTest.java
@@ -0,0 +1,114 @@
+package brooklyn.entity.nosql.couchbase;
+
+import java.util.List;
+import java.util.Map;
+
+import org.testng.annotations.Test;
+
+import brooklyn.entity.AbstractEc2LiveTest;
+import brooklyn.entity.group.DynamicCluster;
+import brooklyn.entity.proxying.EntitySpec;
+import brooklyn.entity.trait.Startable;
+import brooklyn.location.Location;
+import brooklyn.test.EntityTestUtils;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+
+@Test
+public class CouchbaseSyncGatewayEc2LiveTest extends AbstractEc2LiveTest {
+
+    @Override
+    protected void doTest(Location loc) throws Exception {
+        CouchbaseCluster cluster = app.createAndManageChild(EntitySpec.create(CouchbaseCluster.class)
+            .configure(CouchbaseNode.COUCHBASE_ADMIN_USERNAME, "Administrator")
+            .configure(CouchbaseNode.COUCHBASE_ADMIN_PASSWORD, "Password")
+            .configure(DynamicCluster.INITIAL_SIZE, 3)
+            .configure(CouchbaseCluster.CREATE_BUCKETS, (List<Map<String,Object>>)ImmutableList.of(
+                (Map<String,Object>)ImmutableMap.<String, Object>of(
+                    "bucket", "default",
+                    "bucket-ramsize", 100,
+                    "bucket-type", "couchbase",
+                    "bucket-port", 11211
+                ),
+                (Map<String,Object>)ImmutableMap.<String, Object>of(
+                    "bucket", "my_bucket",
+                    "bucket-ramsize", 100,
+                    "bucket-type", "couchbase",
+                    "bucket-port", 11223
+                ),
+                (Map<String,Object>)ImmutableMap.<String, Object>of(
+                    "bucket", "another",
+                    "bucket-ramsize", 100,
+                    "bucket-type", "couchbase",
+                    "bucket-port", 11224
+                ))
+            )
+        );
+        CouchbaseSyncGateway gateway = app.createAndManageChild(EntitySpec.create(CouchbaseSyncGateway.class)
+            .configure(CouchbaseSyncGateway.COUCHBASE_SERVER, cluster)
+            .configure(CouchbaseSyncGateway.COUCHBASE_SERVER_BUCKET, "my_bucket")
+        );
+        
+        app.start(ImmutableList.of(loc));
+        
+        EntityTestUtils.assertAttributeEqualsEventually(gateway, Startable.SERVICE_UP, true);
+    }
+    
+    
+    // Supported operating systems
+    
+    @Override
+    public void test_Ubuntu_12_0() throws Exception {
+        super.test_Ubuntu_12_0();
+    }
+    
+    @Override
+    public void test_Red_Hat_Enterprise_Linux_6() throws Exception {
+        super.test_Red_Hat_Enterprise_Linux_6();
+    }
+    
+    @Override
+    public void test_CentOS_6_3() throws Exception {
+        super.test_CentOS_6_3();
+    }
+    
+    // Unsupported operating systems
+    
+    @Override
+    public void test_CentOS_5_6() throws Exception {
+        // Unsupported
+        // error: Failed dependencies:
+        //     libc.so.6(GLIBC_2.7)(64bit) is needed by couchbase-server-2.5.1-1083.x86_64
+        //        libcrypto.so.10()(64bit) is needed by couchbase-server-2.5.1-1083.x86_64
+        //        libreadline.so.6()(64bit) is needed by couchbase-server-2.5.1-1083.x86_64
+        //        libssl.so.10()(64bit) is needed by couchbase-server-2.5.1-1083.x86_64
+        //        libstdc++.so.6(GLIBCXX_3.4.10)(64bit) is needed by couchbase-server-2.5.1-1083.x86_64
+        //        libstdc++.so.6(GLIBCXX_3.4.11)(64bit) is needed by couchbase-server-2.5.1-1083.x86_64
+        //        libstdc++.so.6(GLIBCXX_3.4.9)(64bit) is needed by couchbase-server-2.5.1-1083.x86_64
+        //        libtinfo.so.5()(64bit) is needed by couchbase-server-2.5.1-1083.x86_64
+        //        openssl >= 1.0.0 is needed by couchbase-server-2.5.1-1083.x86_64
+        //        rpmlib(FileDigests) <= 4.6.0-1 is needed by couchbase-server-2.5.1-1083.x86_64
+        //        rpmlib(PayloadIsXz) <= 5.2-1 is needed by couchbase-server-2.5.1-1083.x86_64
+    }
+    
+    @Override
+    public void test_Debian_6() throws Exception {
+        // Unsupported
+    }
+    
+    @Override
+    public void test_Debian_7_2() throws Exception {
+        // Unsupported
+    }
+    
+    @Override
+    public void test_Ubuntu_10_0() throws Exception {
+        // Unsupported
+        // Installing cannot proceed since the package 'libssl1*' is missing. 
+        // Please install libssl1* and try again. 
+        //    $sudo apt-get install libssl1*
+        //
+        // Installing libssl1* doesn't fix the issue
+    }
+}


Mime
View raw message