Return-Path: X-Original-To: apmail-brooklyn-commits-archive@minotaur.apache.org Delivered-To: apmail-brooklyn-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A62911137E for ; Mon, 1 Sep 2014 16:15:09 +0000 (UTC) Received: (qmail 28715 invoked by uid 500); 1 Sep 2014 16:15:09 -0000 Delivered-To: apmail-brooklyn-commits-archive@brooklyn.apache.org Received: (qmail 28691 invoked by uid 500); 1 Sep 2014 16:15:09 -0000 Mailing-List: contact commits-help@brooklyn.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@brooklyn.incubator.apache.org Delivered-To: mailing list commits@brooklyn.incubator.apache.org Received: (qmail 28682 invoked by uid 99); 1 Sep 2014 16:15:09 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Sep 2014 16:15:09 +0000 X-ASF-Spam-Status: No, hits=-2001.7 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 01 Sep 2014 16:14:42 +0000 Received: (qmail 28139 invoked by uid 99); 1 Sep 2014 16:14:39 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Sep 2014 16:14:39 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id A2EA4957C3B; Mon, 1 Sep 2014 16:14:39 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: heneveld@apache.org To: commits@brooklyn.incubator.apache.org Date: Mon, 01 Sep 2014 16:14:44 -0000 Message-Id: <12cdcd14dad2491c96576fc75e1b6736@git.apache.org> In-Reply-To: <6ef8a7423c7949d2b4503f576dfcaa04@git.apache.org> References: <6ef8a7423c7949d2b4503f576dfcaa04@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [06/17] git commit: Fixed CouchbaseSyncGateway live tests X-Virus-Checked: Checked by ClamAV on apache.org 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 Authored: Tue Jul 1 10:43:16 2014 +0100 Committer: Martin Harris 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.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 cbClusterNode = Iterables.tryFind(cbNode.getAttribute(CouchbaseCluster.GROUP_MEMBERS), new Predicate() { 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>)ImmutableList.of( + (Map)ImmutableMap.of( + "bucket", "default", + "bucket-ramsize", 100, + "bucket-type", "couchbase", + "bucket-port", 11211 + ), + (Map)ImmutableMap.of( + "bucket", "my_bucket", + "bucket-ramsize", 100, + "bucket-type", "couchbase", + "bucket-port", 11223 + ), + (Map)ImmutableMap.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 + } +}