Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Skip 0.8-specific tests if not running against 0.8

  • Loading branch information...
commit 4068d3404f9b989460983b46c54c58d3d6597211 1 parent 6300550
Tyler Hobbs thobbs authored

Showing 1 changed file with 19 additions and 2 deletions. Show diff stats Hide diff stats

  1. +19 2 test/test_cassandraclient.py
21 test/test_cassandraclient.py
@@ -5,6 +5,7 @@
5 5 from telephus.client import CassandraClient
6 6 from telephus.cassandra import constants
7 7 from telephus.cassandra.ttypes import *
  8 +from telephus.translate import getAPIVersion
8 9 import os
9 10 import zlib
10 11
@@ -37,6 +38,9 @@ def setUp(self):
37 38 reactor.connectTCP(HOST, PORT, self.cmanager)
38 39 yield self.cmanager.deferred
39 40
  41 + remote_ver = yield self.client.describe_version()
  42 + self.version = getAPIVersion(remote_ver)
  43 +
40 44 self.my_keyspace = KsDef(
41 45 name=KEYSPACE,
42 46 strategy_class='org.apache.cassandra.locator.SimpleStrategy',
@@ -66,6 +70,10 @@ def setUp(self):
66 70 ],
67 71 default_validation_class='org.apache.cassandra.db.marshal.BytesType'
68 72 ),
  73 + ]
  74 + )
  75 + if self.version == constants.CASSANDRA_08:
  76 + self.my_keyspace.cf_defs.extend([
69 77 CfDef(
70 78 keyspace=KEYSPACE,
71 79 name=COUNTER_CF,
@@ -78,8 +86,8 @@ def setUp(self):
78 86 column_type='Super',
79 87 default_validation_class='org.apache.cassandra.db.marshal.CounterColumnType'
80 88 ),
81   - ]
82   - )
  89 + ])
  90 +
83 91 yield self.client.system_add_keyspace(self.my_keyspace)
84 92 yield self.client.set_keyspace(KEYSPACE)
85 93
@@ -193,6 +201,9 @@ def test_indexed_slices(self):
193 201
194 202 @defer.inlineCallbacks
195 203 def test_counter_add(self):
  204 + if self.version != constants.CASSANDRA_08:
  205 + raise unittest.SkipTest('Counters are not supported in 0.7')
  206 +
196 207 # test standard column counter
197 208 yield self.client.add('test', COUNTER_CF, 1, column='col')
198 209 res = yield self.client.get('test', COUNTER_CF, column='col')
@@ -213,6 +224,9 @@ def test_counter_add(self):
213 224
214 225 @defer.inlineCallbacks
215 226 def test_counter_remove(self):
  227 + if self.version != constants.CASSANDRA_08:
  228 + raise unittest.SkipTest('Counters are not supported in 0.7')
  229 +
216 230 # test standard column counter
217 231 yield self.client.add('test', COUNTER_CF, 1, column='col')
218 232 res = yield self.client.get('test', COUNTER_CF, column='col')
@@ -235,6 +249,9 @@ def test_counter_remove(self):
235 249
236 250 @defer.inlineCallbacks
237 251 def test_cql(self):
  252 + if self.version != constants.CASSANDRA_08:
  253 + raise unittest.SkipTest('CQL is not supported in 0.7')
  254 +
238 255 yield self.client.insert('test', CF, 'testval', column='col1')
239 256 res = yield self.client.get('test', CF, column='col1')
240 257 self.assertEquals(res.column.value, 'testval')

0 comments on commit 4068d34

Please sign in to comment.
Something went wrong with that request. Please try again.