Esempio n. 1
0
    def test_start_clean_connect_stop(self):
        p = PysandraUnit(self.test_schema_yaml)
        servers = p.start()

        cp = CassandraPool('testks', servers)
        cp.cf_connect('ascii')

        p.clean()
        p.stop()
Esempio n. 2
0
    def test_cql_schema(self):
        port = 9999
        host = 'localhost:%s' % port

        p = PysandraUnit(self.test_schema_cql, rpc_port=port)
        servers = p.start()

        self.assertEqual(servers[0], host)

        cp = CassandraPool('testks', [host])
        cp.cf_connect('ascii')

        p.stop()
Esempio n. 3
0
    def test_local_quorum(self):
        p = PysandraUnit(self.test_schema_cql)
        servers = p.start()

        cp = CassandraPool('testks', servers)
        cf = cp.cf_connect('ascii')

        self.assertRaises(pycassa.NotFoundException, cf.get, 'test_key', read_consistency_level=pycassa.ConsistencyLevel.LOCAL_QUORUM)

        p.stop()
Esempio n. 4
0
    def test_connect_clean_2(self):
        self.assertEqual(self.cassandra_server_list, ['localhost:9171'])

        cp = CassandraPool('testks', self.cassandra_server_list)
        cf = cp.cf_connect('ascii')

        self.assertRaises(pycassa.NotFoundException, cf.get, 'test')

        cf.insert('test', {'case': 'a'})
        self.assertEqual(cf.get('test'), {'case': 'a'})