forked from thepaul/cassandra-dtest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcfid_test.py
37 lines (28 loc) · 1.2 KB
/
cfid_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from dtest import Tester
from tools import since
import os
@since('2.1')
class TestCFID(Tester):
def cfid_test(self):
""" Test through adding/dropping cf's that the path to sstables for each cf are unique and formatted correctly """
cluster = self.cluster
cluster.populate(1).start(wait_other_notice=True)
[node1] = cluster.nodelist()
session = self.patient_cql_connection(node1)
self.create_ks(session, 'ks', 1)
for x in range(0, 5):
self.create_cf(session, 'cf', gc_grace=0, key_type='int', columns={'c1': 'int'})
session.execute('insert into cf (key, c1) values (1,1)')
session.execute('insert into cf (key, c1) values (2,1)')
node1.flush()
session.execute('drop table ks.cf;')
# get a list of cf directories
try:
cfs = os.listdir(node1.get_path() + "/data/ks")
except OSError:
self.fail("Path to sstables not valid.")
# check that there are 5 unique directories
self.assertEqual(len(cfs), 5)
# check that these are in fact column family directories
for dire in cfs:
self.assertTrue(dire[0:2] == 'cf')