You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2009/05/04 21:01:46 UTC

svn commit: r771398 - /incubator/cassandra/trunk/test/system/test_server.py

Author: jbellis
Date: Mon May  4 19:01:46 2009
New Revision: 771398

URL: http://svn.apache.org/viewvc?rev=771398&view=rev
Log:
demonstrate problem with _blocking methods by checking insert return values.
patch by jbellis; reviewed by nk11 for CASSANDRA-120

Modified:
    incubator/cassandra/trunk/test/system/test_server.py

Modified: incubator/cassandra/trunk/test/system/test_server.py
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/test/system/test_server.py?rev=771398&r1=771397&r2=771398&view=diff
==============================================================================
--- incubator/cassandra/trunk/test/system/test_server.py (original)
+++ incubator/cassandra/trunk/test/system/test_server.py Mon May  4 19:01:46 2009
@@ -14,13 +14,15 @@
                                          column_t(columnName='c6', value='value6', timestamp=0)])]
 
 def _insert_simple(method=client.insert_blocking):
-    method('Table1', 'key1', 'Standard1:c1', 'value1', 0)
-    method('Table1', 'key1', 'Standard1:c2', 'value2', 0)
+    v1 = method('Table1', 'key1', 'Standard1:c1', 'value1', 0)
+    v2 = method('Table1', 'key1', 'Standard1:c2', 'value2', 0)
+    assert v1 == v2
+    return v1
 
 def _insert_batch(method):
     cfmap = {'Standard1': _SIMPLE_COLUMNS,
              'Standard2': _SIMPLE_COLUMNS}
-    method(batch_mutation_t(table='Table1', key='key1', cfmap=cfmap))
+    return method(batch_mutation_t(table='Table1', key='key1', cfmap=cfmap))
 
 def _verify_batch():
     _verify_simple()
@@ -34,10 +36,11 @@
     assert L == _SIMPLE_COLUMNS, L
 
 def _insert_super():
-    client.insert('Table1', 'key1', 'Super1:sc1:c4', 'value4', 0)
-    client.insert('Table1', 'key1', 'Super1:sc2:c5', 'value5', 0)
-    client.insert('Table1', 'key1', 'Super1:sc2:c6', 'value6', 0)
-    time.sleep(0.1)
+    v1 = client.insert_blocking('Table1', 'key1', 'Super1:sc1:c4', 'value4', 0)
+    v2 = client.insert_blocking('Table1', 'key1', 'Super1:sc2:c5', 'value5', 0)
+    v3 = client.insert_blocking('Table1', 'key1', 'Super1:sc2:c6', 'value6', 0)
+    assert v1 == v2 == v3
+    return v1
 
 def _verify_super(supercolumn='Super1'):
     assert client.get_column('Table1', 'key1', supercolumn + ':sc1:c4') == \
@@ -73,7 +76,7 @@
         _verify_simple()
 
     def test_insert_blocking(self):
-        _insert_simple(client.insert_blocking)
+        assert _insert_simple(client.insert_blocking)
         _verify_simple()
 
     def test_super_insert(self):
@@ -86,7 +89,7 @@
         _verify_batch()
 
     def test_batch_insert_blocking(self):
-        _insert_batch(client.batch_insert_blocking)
+        assert _insert_batch(client.batch_insert_blocking)
         _verify_batch()
 
     def test_batch_insert_super(self):
@@ -105,7 +108,7 @@
          _verify_super('Super2')
 
     def test_cf_remove_column(self):
-        _insert_simple()
+        assert _insert_simple()
         client.remove('Table1', 'key1', 'Standard1:c1', 1, True)
         time.sleep(0.1)
         _expect_missing(lambda: client.get_column('Table1', 'key1', 'Standard1:c1'))
@@ -138,8 +141,8 @@
 
 
     def test_cf_remove(self):
-        _insert_simple()
-        _insert_super()
+        assert _insert_simple()
+        assert _insert_super()
 
         # Remove the key1:Standard1 cf:
         client.remove('Table1', 'key1', 'Standard1', 3, True)
@@ -160,8 +163,8 @@
 
 
     def test_super_cf_remove_column(self):
-        _insert_simple()
-        _insert_super()
+        assert _insert_simple()
+        assert _insert_super()
 
         # Make sure remove clears out what it's supposed to, and _only_ that:
         client.remove('Table1', 'key1', 'Super1:sc2:c5', 5, True)
@@ -205,8 +208,8 @@
                                     column_t(columnName='c7', value='value7', timestamp=0)])], actual
 
     def test_super_cf_remove_supercolumn(self):
-        _insert_simple()
-        _insert_super()
+        assert _insert_simple()
+        assert _insert_super()
 
         # Make sure remove clears out what it's supposed to, and _only_ that:
         client.remove('Table1', 'key1', 'Super1:sc2', 5, True)
@@ -242,7 +245,7 @@
         assert client.get_key_range('Table1', '', '', 1000) == []
 
     def test_range_with_remove(self):
-        _insert_simple()
+        assert _insert_simple()
         assert client.get_key_range('Table1', 'key1', '', 1000) == ['key1']
 
         client.remove('Table1', 'key1', 'Standard1:c1', 1, True)
@@ -251,14 +254,14 @@
 
     def test_range_collation(self):
         for key in ['-a', '-b', 'a', 'b'] + [str(i) for i in xrange(100)]:
-            client.insert_blocking('Table1', key, 'Standard1:' + key, 'v', 0)
+            assert client.insert_blocking('Table1', key, 'Standard1:' + key, 'v', 0)
         L = client.get_key_range('Table1', '', '', 1000)
         # note the collated ordering rather than ascii
         assert L == ['0', '1', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '2', '20', '21', '22', '23', '24', '25', '26', '27','28', '29', '3', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '4', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '5', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '6', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '7', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '8', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '9', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', 'a', '-a', 'b', '-b'], L
 
     def test_range_partial(self):
         for key in ['-a', '-b', 'a', 'b'] + [str(i) for i in xrange(100)]:
-            client.insert_blocking('Table1', key, 'Standard1:' + key, 'v', 0)
+            assert client.insert_blocking('Table1', key, 'Standard1:' + key, 'v', 0)
 
         L = client.get_key_range('Table1', 'a', '', 1000)
         assert L == ['a', '-a', 'b', '-b'], L