Repository: cassandra
Updated Branches:
  refs/heads/trunk b4839a388 -> d5cfe2b4a


Attempt to fix intermittent failure of DeleteTest


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/c81dc4bb
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/c81dc4bb
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/c81dc4bb

Branch: refs/heads/trunk
Commit: c81dc4bb23da7f4e6c2c7738758db9d483d69292
Parents: dd4fbbc
Author: Sylvain Lebresne <sylv...@datastax.com>
Authored: Fri Sep 5 10:50:13 2014 +0200
Committer: Sylvain Lebresne <sylv...@datastax.com>
Committed: Fri Sep 5 10:50:24 2014 +0200

----------------------------------------------------------------------
 .../unit/org/apache/cassandra/cql3/DeleteTest.java | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/c81dc4bb/test/unit/org/apache/cassandra/cql3/DeleteTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/DeleteTest.java 
b/test/unit/org/apache/cassandra/cql3/DeleteTest.java
index 7782f12..44bef05 100644
--- a/test/unit/org/apache/cassandra/cql3/DeleteTest.java
+++ b/test/unit/org/apache/cassandra/cql3/DeleteTest.java
@@ -28,6 +28,7 @@ import org.apache.cassandra.config.Schema;
 import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.service.EmbeddedCassandraService;
 import org.junit.Assert;
+import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -48,14 +49,19 @@ public class DeleteTest extends SchemaLoader
     private static PreparedStatement pstmt4;
     private static PreparedStatement pstmt5;
 
-    @BeforeClass()
-    public static void setup() throws ConfigurationException, IOException
+    @BeforeClass
+    public static void setup() throws Exception
     {
         Schema.instance.clear();
 
         cassandra = new EmbeddedCassandraService();
         cassandra.start();
 
+        // Currently the native server start method return before the server 
is fully binded to the socket,
+        // so we need to wait slightly before trying to connect to it. We 
should fix this but in the meantime
+        // using a sleep.
+        Thread.sleep(500);
+
         cluster = 
Cluster.builder().addContactPoint("127.0.0.1").withPort(DatabaseDescriptor.getNativeTransportPort()).build();
         session = cluster.connect();
 
@@ -107,7 +113,12 @@ public class DeleteTest extends SchemaLoader
         pstmt5 = session.prepare("select id, cid, inh_c, val from 
junit.tpc_inherit_c where id=? and cid=?");
     }
 
-
+    @AfterClass
+    public static void tearDown() throws Exception
+    {
+        cluster.close();
+        cassandra.stop();
+    }
 
     @Test
     public void lostDeletesTest()

Reply via email to