You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by al...@apache.org on 2013/05/11 00:37:16 UTC

[1/3] git commit: Ninja-unify 1.1/1.2/2.0 system tests

Updated Branches:
  refs/heads/cassandra-1.2 c3ff774de -> 26995337b


Ninja-unify 1.1/1.2/2.0 system tests


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

Branch: refs/heads/cassandra-1.2
Commit: 971a95abfc23dd0e265d439f4d2f024d2c552370
Parents: fe910e6
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Mon May 6 00:59:10 2013 +0300
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Mon May 6 00:59:10 2013 +0300

----------------------------------------------------------------------
 test/cassandra.in.sh    |    2 +-
 test/system/__init__.py |    8 +++++---
 2 files changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/971a95ab/test/cassandra.in.sh
----------------------------------------------------------------------
diff --git a/test/cassandra.in.sh b/test/cassandra.in.sh
index 682327f..936f47d 100644
--- a/test/cassandra.in.sh
+++ b/test/cassandra.in.sh
@@ -39,7 +39,7 @@ JVM_OPTS=" \
         -Xrunjdwp:transport=dt_socket,server=y,address=8898,suspend=n \
         -Xms128M \
         -Xmx1G \
-        -Xss128k \
+        -Xss180k \
         -XX:SurvivorRatio=8 \
         -XX:TargetSurvivorRatio=90 \
         -XX:+AggressiveOpts \

http://git-wip-us.apache.org/repos/asf/cassandra/blob/971a95ab/test/system/__init__.py
----------------------------------------------------------------------
diff --git a/test/system/__init__.py b/test/system/__init__.py
index d9b88ee..669bf6d 100644
--- a/test/system/__init__.py
+++ b/test/system/__init__.py
@@ -65,14 +65,14 @@ class BaseTester(object):
             if os.path.exists(pid_fname):
                 pid_path = os.path.join(root, pid_fname)
                 print "Unclean shutdown detected, (%s found)" % pid_path
-                sys.exit()
+                raise Exception('damn it')
 
             # clean out old stuff
             import shutil
             # todo get directories from conf/cassandra.yaml
             for dirname in ['system', 'data', 'commitlog']:
                 try:
-                    shutil.rmtree('build/test/cassandra/' + dirname)
+                    shutil.rmtree(os.path.join(root, 'build', 'test', 'cassandra', dirname))
                 except OSError:
                     pass
             # start the server
@@ -103,7 +103,7 @@ class BaseTester(object):
                     stdout_value, stderr_value = process.communicate()
                     print "Stdout: %s" % (stdout_value)
                     print "Stderr: %s" % (stderr_value)
-                sys.exit()
+                raise Exception('damn it')
         else:
             try:
                 self.open_client()
@@ -132,6 +132,8 @@ class BaseTester(object):
                 if not is_alive(spid):
                     break
                 slept += 0.5
+            # Give time for cassandra to shutdown
+            time.sleep(2)
             if (slept > max_wait and is_alive(spid)):
                 os.kill(spid, signal.SIGKILL)
                 fpath = os.path.join(root, pid_fname)


[2/3] git commit: Move CassandraServerTest.test_get_count() to thrift server tests

Posted by al...@apache.org.
Move CassandraServerTest.test_get_count() to thrift server tests


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

Branch: refs/heads/cassandra-1.2
Commit: ce8bc33d438dc0877a2bcb0049d4c1d84db508d5
Parents: 971a95a
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Sat May 11 01:30:17 2013 +0300
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Sat May 11 01:30:17 2013 +0300

----------------------------------------------------------------------
 test/system/test_thrift_server.py                  |   29 +++++
 .../cassandra/service/CassandraServerTest.java     |   88 ---------------
 2 files changed, 29 insertions(+), 88 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/ce8bc33d/test/system/test_thrift_server.py
----------------------------------------------------------------------
diff --git a/test/system/test_thrift_server.py b/test/system/test_thrift_server.py
index bcb75e8..8c459f2 100644
--- a/test/system/test_thrift_server.py
+++ b/test/system/test_thrift_server.py
@@ -273,6 +273,35 @@ class TestMutations(ThriftTester):
         p = SlicePredicate(slice_range=SliceRange('', '', False, 10))
         assert client.get_count('key1', ColumnParent('Standard1'), p, ConsistencyLevel.ONE) == 10
 
+    # test get_count() to work correctly with 'count' settings around page size (CASSANDRA-4833)
+    def test_count_around_page_size(self):
+        def slice_predicate(count):
+            return SlicePredicate(slice_range=SliceRange('', '', False, count))
+
+        _set_keyspace('Keyspace1')
+
+        key = 'key1'
+        parent = ColumnParent('Standard1')
+        cl = ConsistencyLevel.ONE
+
+        for i in xrange(0, 3050):
+            client.insert(key, parent, Column(str(i), '', 0), cl)
+
+        # same as page size
+        assert client.get_count(key, parent, slice_predicate(1024), cl) == 1024
+
+        # 1 above page size
+        assert client.get_count(key, parent, slice_predicate(1025), cl) == 1025
+
+        # above number or columns
+        assert client.get_count(key, parent, slice_predicate(4000), cl) == 3050
+
+        # same as number of columns
+        assert client.get_count(key, parent, slice_predicate(3050), cl) == 3050
+
+        # 1 above number of columns
+        assert client.get_count(key, parent, slice_predicate(3051), cl) == 3050
+
     def test_insert_blocking(self):
         _set_keyspace('Keyspace1')
         _insert_simple()

http://git-wip-us.apache.org/repos/asf/cassandra/blob/ce8bc33d/test/unit/org/apache/cassandra/service/CassandraServerTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/service/CassandraServerTest.java b/test/unit/org/apache/cassandra/service/CassandraServerTest.java
deleted file mode 100644
index 48701de..0000000
--- a/test/unit/org/apache/cassandra/service/CassandraServerTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
-* 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 org.apache.cassandra.service;
-
-import org.junit.Test;
-
-import org.apache.cassandra.SchemaLoader;
-import org.apache.cassandra.Util;
-import org.apache.cassandra.config.Schema;
-import org.apache.cassandra.db.DecoratedKey;
-import org.apache.cassandra.db.RowMutation;
-import org.apache.cassandra.db.filter.QueryPath;
-import org.apache.cassandra.thrift.*;
-import org.apache.cassandra.utils.ByteBufferUtil;
-
-public class CassandraServerTest extends SchemaLoader
-{
-    /**
-     * test get_count() to work correctly with 'count' settings around page size.
-     * (CASSANDRA-4833)
-     */
-    @Test
-    public void test_get_count() throws Exception
-    {
-        Schema.instance.clear(); // Schema are now written on disk and will be reloaded
-        new EmbeddedCassandraService().start();
-
-        DecoratedKey key = Util.dk("testkey");
-        for (int i = 0; i < 3050; i++)
-        {
-            RowMutation rm = new RowMutation("Keyspace1", key.key);
-            rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes(String.valueOf(i))),
-                          ByteBufferUtil.EMPTY_BYTE_BUFFER,
-                          System.currentTimeMillis());
-            rm.apply();
-        }
-
-        CassandraServer server = new CassandraServer();
-        server.set_keyspace("Keyspace1");
-
-        // same as page size
-        int count = server.get_count(key.key, new ColumnParent("Standard1"), predicateWithCount(1024), ConsistencyLevel.ONE);
-        assert count == 1024 : "expected 1024 but was " + count;
-
-        // 1 above page size
-        count = server.get_count(key.key, new ColumnParent("Standard1"), predicateWithCount(1025), ConsistencyLevel.ONE);
-        assert count == 1025 : "expected 1025 but was " + count;
-
-        // above number of columns
-        count = server.get_count(key.key, new ColumnParent("Standard1"), predicateWithCount(4000), ConsistencyLevel.ONE);
-        assert count == 3050 : "expected 3050 but was " + count;
-
-        // same as number of columns
-        count = server.get_count(key.key, new ColumnParent("Standard1"), predicateWithCount(3050), ConsistencyLevel.ONE);
-        assert count == 3050 : "expected 3050 but was " + count;
-
-        // 1 above number of columns
-        count = server.get_count(key.key, new ColumnParent("Standard1"), predicateWithCount(3051), ConsistencyLevel.ONE);
-        assert count == 3050 : "expected 3050 but was " + count;
-    }
-
-    private SlicePredicate predicateWithCount(int count)
-    {
-        SliceRange range = new SliceRange();
-        range.setStart("".getBytes());
-        range.setFinish("".getBytes());
-        range.setCount(count);
-        SlicePredicate predicate = new SlicePredicate();
-        predicate.setSlice_range(range);
-        return predicate;
-    }
-}


[3/3] git commit: Merge branch 'cassandra-1.1' into cassandra-1.2

Posted by al...@apache.org.
Merge branch 'cassandra-1.1' into cassandra-1.2

Conflicts:
	test/unit/org/apache/cassandra/service/CassandraServerTest.java


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

Branch: refs/heads/cassandra-1.2
Commit: 26995337b8d65f7af8eb12ef3a2c946fc4ad41c1
Parents: c3ff774 ce8bc33
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Sat May 11 01:37:00 2013 +0300
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Sat May 11 01:37:00 2013 +0300

----------------------------------------------------------------------
 test/system/test_thrift_server.py                  |   29 +++++
 .../cassandra/service/CassandraServerTest.java     |   91 ---------------
 2 files changed, 29 insertions(+), 91 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/26995337/test/system/test_thrift_server.py
----------------------------------------------------------------------