test_round_trip_with_rate_file | Failure | AssertionError: assert False
+ where False = <built-in method startswith of str object at 0x7f334e4bb430>('Processed: 200000 rows;')
+ where <built-in method startswith of str object at 0x7f334e4bb430> = 'Processed: 195000 rows; Rate: 29372 rows/s; Avg. rate: 2029 rows/s'.startswith
+ and 'Processed: 200000 rows;' = <built-in method format of str object at 0x7f335d9d58f0>(200000)
+ where <built-in method format of str object at 0x7f335d9d58f0> = 'Processed: {} rows;'.format
self = <cqlsh_tests.test_cqlsh_copy.TestCqlshCopy object at 0x7f335d9a5f40>
def test_round_trip_with_rate_file(self):
"""
Test a round trip with a large number of rows and a rate file. Make sure the rate file contains
output statistics
@jira_ticket CASSANDRA-9303
"""
num_rows = 200000
report_frequency = 0.1 # every 100 milliseconds
stress_table = 'keyspace1.standard1'
ratefile = self.get_temp_file()
tempfile = self.get_temp_file()
def check_rate_file():
lines = [line.rstrip('\n') for line in open(ratefile.name)]
logger.debug(lines)
assert lines[-1].startswith('Processed: {} rows;'.format(num_rows))
self.prepare()
logger.debug('Running stress')
self.node1.stress(['write', 'n={}'.format(num_rows), 'no-warmup', '-rate', 'threads=50'])
logger.debug('Exporting to csv file: {}'.format(tempfile.name))
self.run_cqlsh(cmds="COPY {} TO '{}' WITH RATEFILE='{}' AND REPORTFREQUENCY='{}'"
.format(stress_table, tempfile.name, ratefile.name, report_frequency))
# check all records were exported
assert num_rows == len(open(tempfile.name).readlines())
check_rate_file()
# clean-up
os.unlink(ratefile.name)
self.session.execute("TRUNCATE {}".format(stress_table))
logger.debug('Importing from csv file: {}'.format(tempfile.name))
self.run_cqlsh(cmds="COPY {} FROM '{}' WITH RATEFILE='{}' AND REPORTFREQUENCY='{}'"
.format(stress_table, tempfile.name, ratefile.name, report_frequency))
# check all records were imported
assert [[num_rows]] == rows_to_list(self.session.execute("SELECT COUNT(*) FROM {}"
.format(stress_table)))
> check_rate_file()
cqlsh_tests/test_cqlsh_copy.py:2139:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
def check_rate_file():
lines = [line.rstrip('\n') for line in open(ratefile.name)]
logger.debug(lines)
> assert lines[-1].startswith('Processed: {} rows;'.format(num_rows))
E AssertionError: assert False
E + where False = <built-in method startswith of str object at 0x7f334e4bb430>('Processed: 200000 rows;')
E + where <built-in method startswith of str object at 0x7f334e4bb430> = 'Processed: 195000 rows; Rate: 29372 rows/s; Avg. rate: 2029 rows/s'.startswith
E + and 'Processed: 200000 rows;' = <built-in method format of str object at 0x7f335d9d58f0>(200000)
E + where <built-in method format of str object at 0x7f335d9d58f0> = 'Processed: {} rows;'.format
cqlsh_tests/test_cqlsh_copy.py:2111: AssertionError | 143.848 |