You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ee...@apache.org on 2011/02/17 02:23:36 UTC
svn commit: r1071469 - /cassandra/trunk/test/system/test_cql.py
Author: eevans
Date: Thu Feb 17 01:23:36 2011
New Revision: 1071469
URL: http://svn.apache.org/viewvc?rev=1071469&view=rev
Log:
system tests for CREATE INDEX
Patch by eevans for CASSANDRA-1709
Modified:
cassandra/trunk/test/system/test_cql.py
Modified: cassandra/trunk/test/system/test_cql.py
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/system/test_cql.py?rev=1071469&r1=1071468&r2=1071469&view=diff
==============================================================================
--- cassandra/trunk/test/system/test_cql.py (original)
+++ cassandra/trunk/test/system/test_cql.py Thu Feb 17 01:23:36 2011
@@ -308,6 +308,29 @@ class TestCql(ThriftTester):
for coldef in cfam.column_metadata:
assert coldef.name in ("a", "b"), "Unknown column name"
assert coldef.validation_class.endswith("marshal.IntegerType")
+
+ def test_create_indexs(self):
+ "creating column indexes"
+ conn = init()
+ conn.execute("USE Keyspace1")
+ conn.execute("CREATE COLUMNFAMILY CreateIndex1")
+ conn.execute("CREATE INDEX namedIndex ON CreateIndex1 (\"items\")")
+ conn.execute("CREATE INDEX ON CreateIndex1 (\"stuff\")")
+
+ # TODO: temporary (until this can be done with CQL).
+ ksdef = thrift_client.describe_keyspace("Keyspace1")
+ cfam = [i for i in ksdef.cf_defs if i.name == "CreateIndex1"][0]
+ items = [i for i in cfam.column_metadata if i.name == "items"][0]
+ stuff = [i for i in cfam.column_metadata if i.name == "stuff"][0]
+ assert items.index_name == "namedIndex", "missing index (or name)"
+ assert items.index_type == 0, "missing index"
+ assert not stuff.index_name, \
+ "index_name should be unset, not %s" % stuff.index_name
+ assert stuff.index_type == 0, "missing index"
+
+ assert_raises(CQLException,
+ conn.execute,
+ "CREATE INDEX ON CreateIndex1 (\"stuff\")")
def test_time_uuid(self):
"store and retrieve time-based (type 1) uuids"