mirror of https://github.com/apache/cassandra
Merge branch 'cassandra-3.9' into trunk
This commit is contained in:
commit
f129dea869
|
|
@ -17,6 +17,8 @@
|
|||
3.9
|
||||
Merged from 3.0:
|
||||
* Fix problem with undeleteable rows on upgrade to new sstable format (CASSANDRA-12144)
|
||||
Merged from 2.2:
|
||||
* Fixed cqlshlib.test.remove_test_db (CASSANDRA-12214)
|
||||
|
||||
3.8
|
||||
* Fix hdr logging for single operation workloads (CASSANDRA-12145)
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from .cassconnect import create_test_db, remove_test_db
|
||||
from .cassconnect import create_db, remove_db
|
||||
|
||||
setUp = create_test_db
|
||||
tearDown = remove_test_db
|
||||
setUp = create_db
|
||||
tearDown = remove_db
|
||||
|
|
|
|||
|
|
@ -35,15 +35,15 @@ def get_cassandra_cursor(cql_version=None):
|
|||
|
||||
TEST_KEYSPACES_CREATED = []
|
||||
|
||||
def get_test_keyspace():
|
||||
return TEST_KEYSPACES_CREATED[-1]
|
||||
def get_keyspace():
|
||||
return None if len(TEST_KEYSPACES_CREATED) == 0 else TEST_KEYSPACES_CREATED[-1]
|
||||
|
||||
def make_test_ks_name():
|
||||
def make_ks_name():
|
||||
# abuse mktemp to get a quick random-ish name
|
||||
return os.path.basename(tempfile.mktemp(prefix='CqlshTests_'))
|
||||
|
||||
def create_test_keyspace(cursor):
|
||||
ksname = make_test_ks_name()
|
||||
def create_keyspace(cursor):
|
||||
ksname = make_ks_name()
|
||||
qksname = quote_name(ksname)
|
||||
cursor.execute('''
|
||||
CREATE KEYSPACE %s WITH replication =
|
||||
|
|
@ -70,13 +70,13 @@ def execute_cql_file(cursor, fname):
|
|||
with open(fname) as f:
|
||||
return execute_cql_commands(cursor, f.read())
|
||||
|
||||
def create_test_db():
|
||||
def create_db():
|
||||
with cassandra_cursor(ks=None) as c:
|
||||
k = create_test_keyspace(c)
|
||||
k = create_keyspace(c)
|
||||
execute_cql_file(c, test_keyspace_init)
|
||||
return k
|
||||
|
||||
def remove_test_db():
|
||||
def remove_db():
|
||||
with cassandra_cursor(ks=None) as c:
|
||||
c.execute('DROP KEYSPACE %s' % quote_name(TEST_KEYSPACES_CREATED.pop(-1)))
|
||||
|
||||
|
|
@ -110,7 +110,7 @@ def cassandra_cursor(cql_version=None, ks=''):
|
|||
"""
|
||||
|
||||
if ks == '':
|
||||
ks = get_test_keyspace()
|
||||
ks = get_keyspace()
|
||||
conn = get_cassandra_connection(cql_version=cql_version)
|
||||
try:
|
||||
c = conn.connect(ks)
|
||||
|
|
@ -129,10 +129,10 @@ def testrun_cqlsh(keyspace=DEFAULTVAL, **kwargs):
|
|||
# use a positive default sentinel so that keyspace=None can be used
|
||||
# to override the default behavior
|
||||
if keyspace is DEFAULTVAL:
|
||||
keyspace = get_test_keyspace()
|
||||
keyspace = get_keyspace()
|
||||
return run_cqlsh(keyspace=keyspace, **kwargs)
|
||||
|
||||
def testcall_cqlsh(keyspace=None, **kwargs):
|
||||
if keyspace is None:
|
||||
keyspace = get_test_keyspace()
|
||||
keyspace = get_keyspace()
|
||||
return call_cqlsh(keyspace=keyspace, **kwargs)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import re
|
|||
from itertools import izip
|
||||
from .basecase import (BaseTestCase, cqlshlog, dedent, at_a_time, cqlsh,
|
||||
TEST_HOST, TEST_PORT)
|
||||
from .cassconnect import (get_test_keyspace, testrun_cqlsh, testcall_cqlsh,
|
||||
from .cassconnect import (get_keyspace, testrun_cqlsh, testcall_cqlsh,
|
||||
cassandra_cursor, split_cql_commands, quote_name)
|
||||
from .ansi_colors import (ColoredText, lookup_colorcode, lookup_colorname,
|
||||
lookup_colorletter, ansi_seq)
|
||||
|
|
@ -527,10 +527,10 @@ class TestCqlshOutput(BaseTestCase):
|
|||
output = c.read_to_next_prompt().replace('\r\n', '\n')
|
||||
self.assertTrue(output.endswith('cqlsh> '))
|
||||
|
||||
cmd = "USE \"%s\";\n" % get_test_keyspace().replace('"', '""')
|
||||
cmd = "USE \"%s\";\n" % get_keyspace().replace('"', '""')
|
||||
c.send(cmd)
|
||||
output = c.read_to_next_prompt().replace('\r\n', '\n')
|
||||
self.assertTrue(output.endswith('cqlsh:%s> ' % (get_test_keyspace())))
|
||||
self.assertTrue(output.endswith('cqlsh:%s> ' % (get_keyspace())))
|
||||
|
||||
c.send('use system;\n')
|
||||
output = c.read_to_next_prompt().replace('\r\n', '\n')
|
||||
|
|
@ -553,7 +553,7 @@ class TestCqlshOutput(BaseTestCase):
|
|||
|
||||
def test_describe_keyspace_output(self):
|
||||
with testrun_cqlsh(tty=True) as c:
|
||||
ks = get_test_keyspace()
|
||||
ks = get_keyspace()
|
||||
qks = quote_name(ks)
|
||||
for cmd in ('describe keyspace', 'desc keyspace'):
|
||||
for givename in ('system', '', qks):
|
||||
|
|
@ -625,7 +625,7 @@ class TestCqlshOutput(BaseTestCase):
|
|||
AND read_repair_chance = 0.0
|
||||
AND speculative_retry = '99PERCENTILE';
|
||||
|
||||
""" % quote_name(get_test_keyspace()))
|
||||
""" % quote_name(get_keyspace()))
|
||||
|
||||
with testrun_cqlsh(tty=True) as c:
|
||||
for cmdword in ('describe table', 'desc columnfamily'):
|
||||
|
|
@ -643,7 +643,7 @@ class TestCqlshOutput(BaseTestCase):
|
|||
\n
|
||||
'''
|
||||
|
||||
ks = get_test_keyspace()
|
||||
ks = get_keyspace()
|
||||
|
||||
with testrun_cqlsh(tty=True, keyspace=None) as c:
|
||||
|
||||
|
|
@ -704,7 +704,7 @@ class TestCqlshOutput(BaseTestCase):
|
|||
self.assertNoHasColors(output)
|
||||
self.assertRegexpMatches(output, output_re + '$')
|
||||
|
||||
c.send('USE %s;\n' % quote_name(get_test_keyspace()))
|
||||
c.send('USE %s;\n' % quote_name(get_keyspace()))
|
||||
c.read_to_next_prompt()
|
||||
|
||||
for semicolon in ('', ';'):
|
||||
|
|
|
|||
Loading…
Reference in New Issue