Author: asavu
Date: Sat Dec 10 23:11:07 2011
New Revision: 1212920

URL: http://svn.apache.org/viewvc?rev=1212920&view=rev
Log:
WHIRR-437, Cassandra integration test is failing (asavu)

Modified:
    whirr/trunk/CHANGES.txt
    
whirr/trunk/services/cassandra/src/main/resources/functions/configure_cassandra.sh
    
whirr/trunk/services/cassandra/src/test/java/org/apache/whirr/service/cassandra/integration/CassandraServiceTest.java

Modified: whirr/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/whirr/trunk/CHANGES.txt?rev=1212920&r1=1212919&r2=1212920&view=diff
==============================================================================
--- whirr/trunk/CHANGES.txt (original)
+++ whirr/trunk/CHANGES.txt Sat Dec 10 23:11:07 2011
@@ -96,8 +96,6 @@ Trunk (unreleased changes)
 
     WHIRR-446. Upgrade all maven plugins to latest stable release (asavu)
 
-    WHIRR-447. FastDnsResolver fails with SocketTimeoutException (asavu)
-
   BUG FIXES
 
     WHIRR-377. Fix broken CLI logging config. (asavu via tomwhite)
@@ -115,6 +113,10 @@ Trunk (unreleased changes)
     gmond.conf (Joris Bontje via asavu)
 
     WHIRR-432. Puppet integration tests failing (Alex Heneveld via asavu)
+
+    WHIRR-447. FastDnsResolver fails with SocketTimeoutException (asavu)
+
+    WHIRR-437, Cassandra integration test is failing (asavu)
     
 Release 0.6.0 - 2011-08-17
 

Modified: 
whirr/trunk/services/cassandra/src/main/resources/functions/configure_cassandra.sh
URL: 
http://svn.apache.org/viewvc/whirr/trunk/services/cassandra/src/main/resources/functions/configure_cassandra.sh?rev=1212920&r1=1212919&r2=1212920&view=diff
==============================================================================
--- 
whirr/trunk/services/cassandra/src/main/resources/functions/configure_cassandra.sh
 (original)
+++ 
whirr/trunk/services/cassandra/src/main/resources/functions/configure_cassandra.sh
 Sat Dec 10 23:11:07 2011
@@ -32,7 +32,7 @@ function configure_cassandra() {
     #TODO set replication
     sed -i -e "s|<Seed>127.0.0.1</Seed>|$seeds|" $config_file
     sed -i -e 
"s|<ListenAddress>localhost</ListenAddress>|<ListenAddress>$PRIVATE_IP</ListenAddress>|"
 $config_file
-    sed -i -e 
"s|<ThriftAddress>localhost</ThriftAddress>|<ThriftAddress>$PUBLIC_IP</ThriftAddress>|"
 $config_file
+    sed -i -e 
"s|<ThriftAddress>localhost</ThriftAddress>|<ThriftAddress>0.0.0.0</ThriftAddress>|"
 $config_file
   else
     config_file="/etc/cassandra/conf/cassandra.yaml"
     if [[ "x"`grep -e '^seeds:' $config_file` == "x" ]]; then
@@ -51,7 +51,7 @@ function configure_cassandra() {
     fi
   
     sed -i -e "s|listen_address: localhost|listen_address: $PRIVATE_IP|" 
$config_file
-    sed -i -e "s|rpc_address: localhost|rpc_address: $PUBLIC_IP|" $config_file
+    sed -i -e "s|rpc_address: localhost|rpc_address: 0.0.0.0|" $config_file
   fi
 }
 

Modified: 
whirr/trunk/services/cassandra/src/test/java/org/apache/whirr/service/cassandra/integration/CassandraServiceTest.java
URL: 
http://svn.apache.org/viewvc/whirr/trunk/services/cassandra/src/test/java/org/apache/whirr/service/cassandra/integration/CassandraServiceTest.java?rev=1212920&r1=1212919&r2=1212920&view=diff
==============================================================================
--- 
whirr/trunk/services/cassandra/src/test/java/org/apache/whirr/service/cassandra/integration/CassandraServiceTest.java
 (original)
+++ 
whirr/trunk/services/cassandra/src/test/java/org/apache/whirr/service/cassandra/integration/CassandraServiceTest.java
 Sat Dec 10 23:11:07 2011
@@ -43,8 +43,12 @@ import org.apache.whirr.service.cassandr
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class CassandraServiceTest {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(CassandraServiceTest.class);
    
   private ClusterSpec clusterSpec;
   private ClusterController controller;
@@ -62,12 +66,10 @@ public class CassandraServiceTest {
     controller = new ClusterController();
     cluster = controller.launchCluster(clusterSpec);
 
-    // give it a sec to boot up the cluster
     waitForCassandra();
   }
 
-  private Cassandra.Client client(Instance instance) throws TException
-  {
+  private Cassandra.Client client(Instance instance) throws TException {
     TTransport trans = new TFramedTransport(new TSocket(
         instance.getPublicIp(),
         CassandraClusterActionHandler.CLIENT_PORT));
@@ -77,22 +79,30 @@ public class CassandraServiceTest {
   }
 
   private void waitForCassandra() {
+    LOG.info("Waiting for Cassandra to start");
     for (Instance instance : cluster.getInstances()) {
-      while (true) {
+      int tries = 0;
+      while (tries < 10) {
         try {
           Cassandra.Client client = client(instance);
           client.describe_cluster_name();
           client.getOutputProtocol().getTransport().close();
+          LOG.info(instance.getPublicIp() + " is up and running");
           break;
+
         } catch (TException e) {
-          System.out.print(".");
           try {
+            LOG.warn(instance.getPublicIp() + " not reachable, try #" + tries 
+ ", waiting 1s");
             Thread.sleep(1000);
           } catch (InterruptedException e1) {
             break;
           }
+          tries += 1;
         }
       }
+      if (tries == 10) {
+        LOG.error("Instance " + instance.getPublicIp() + " is still 
unavailable after 10 retries");
+      }
     }
   }
 
@@ -107,6 +117,7 @@ public class CassandraServiceTest {
       }
       client.getOutputProtocol().getTransport().close();
     }
+    LOG.info("List of endpoints: " + endPoints);
     
     for (Instance instance : cluster.getInstances()) {
       String address = instance.getPrivateAddress().getHostAddress();


Reply via email to