Bug: Test Failure: dtest-novnode.cqlsh_tests.test_cqlsh_copy.TestCqlshCopy.test_round_trip_with_rate_file (from Cassandra dtests)
Status: Open
Priority: Normal
Created: 28/Jan/22 18:50

https://ci-cassandra.apache.org/job/Cassandra-4.0/323/testReport/dtest-novnode.cqlsh_tests.test_cqlsh_copy/TestCqlshCopy/test_round_trip_with_rate_file/

Failed 1 times in the last 30 runs. Flakiness: 3%, Stability: 96%
Error Message
AssertionError: assert False  +  where False = <built-in method startswith of str object at 0x7fdf40cf0530>('Processed: 200000 rows;')  +    where <built-in method startswith of str object at 0x7fdf40cf0530> = 'Processed: 195000 rows; Rate:   19167 rows/s; Avg. rate:    1583 rows/s'.startswith  +    and   'Processed: 200000 rows;' = <built-in method format of str object at 0x7fdf426f23a0>(200000)  +      where <built-in method format of str object at 0x7fdf426f23a0> = 'Processed: {} rows;'.format

{code}
Stacktrace
self = <cqlsh_tests.test_cqlsh_copy.TestCqlshCopy object at 0x7fdf0d6dd790>

    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 0x7fdf40cf0530>('Processed: 200000 rows;')
E        +    where <built-in method startswith of str object at 0x7fdf40cf0530> = 'Processed: 195000 rows; Rate:   19167 rows/s; Avg. rate:    1583 rows/s'.startswith
E        +    and   'Processed: 200000 rows;' = <built-in method format of str object at 0x7fdf426f23a0>(200000)
E        +      where <built-in method format of str object at 0x7fdf426f23a0> = 'Processed: {} rows;'.format

cqlsh_tests/test_cqlsh_copy.py:2111: AssertionError
{code}